How do Vector Clocks work and whats their advantage in comparision to Lamport Clocks?

Vector clocks store relationships between events
It is possbile to answer if two events are causally related

Synchronization Algorithm
Each node keeps its own vector clock
A single entry in the vector/array is a pair of node name and counter: (A:4)
Each node starts with a single entry with its own node name

Before each event, the own counter is incremented and the full vector is sent with the message
On message receive, the incoming message is merged with the existing local vector, where always the maximum counter values are choosen
 


Events can be partially, causally ordered
No total ordering possible (If events don't share any history, we can not oder them)

Diskussion