DISTRIBUTED SYSTEM
CHAPTER 10 : CASE STUDY
LAB WORK SOLUTION- DISTRIBUTED SYSTEM
DISTRIBUTED SYSTEM -BCA -ALL SLIDES
MCQ- DISTRIBUTED SYSTEM

Vector Clock 

Vector clocks are used in distributed systems to determine whether pairs of events are causally related. With vector clocks, timestamps are generated for each event in the system, and their causal relationships are determined by comparing these timestamps. This algorithm labels each process with a vector (or list) containing an integer for each local clock of every process within the system. Therefore, for NNN processes, there will be a vector or array of size NNN.

Algorithm

Initially, all clocks are set to zero. Each time an internal event occurs in a process, the value of that process's logical clock in the vector is incremented by 1. Additionally, whenever a process sends a message, the value of its logical clock in the vector is incremented by 1.

Every time, a process receives a message, the value of the processes’s logical clock in the vector is incremented by 1.

Advantage of Vector Clock over Lamports Clock

Lamport timestamps and vector clocks are both logical clocks, and both provide a total ordering of events consistent with causalityVector clocks allow you to determine if any two arbitrarily selected events are causally dependent or concurrent. Lamport timestamps cannot do this.