Vector Clocks Flashcards
What is a Vector Clock?
A vector clock for a system of N processes is an array of N integers
How does a Vector clock work?
Each process keeps its own vector clock Vi, which it uses to timestamp local events.
Processes then attach vector timestamps on the messages they send to one another
State the Rule for updating vector clocks: VC1
VC1: Initially, Vi[j] = 0 for i, j = 1, 2, …, N
State the Rule for updating vector clocks: VC2
VC2: Just before pi
timestamps an event, its sets Vi[i] = Vi[i] + 1
State the Rule for updating vector clocks: VC3
VC3: pi includes the value t = Vi in every message it sends
State the Rule for updating vector clocks: VC4
VC4: When pi receives a timestamp in a message,it sets Vi[j] = max(Vi[j], t[j]) for j = 1, 2, …, N
What is Vi[i]
Vi[i] is the number of events that pi has timestamped
What is Vi[j]
Vi[j] for j ≠ i is the number of events that have occurred at pj that potentially have affected pi
How can vector timestamps be compared?
♦ V = V’ V[j] = V’[j] for j = 1, 2, …, N
♦ V ≤ V’ V[j] ≤ V’[j] for j = 1, 2, …, N
♦ V < V’ V ≤ V’ and V ≠ V’
Give an advantage of Vector clocks
Allows causal ordering for all events in the system
Give a disadvantage of Vector clocks
storage and message overhead proportional to N, the number of processes