Skip to content
StackDecode
System Design
6. Distributed Systems FundamentalsAnimated

Vector Clocks

One counter per process to detect concurrency.

The idea

Each process stores a vector. Comparing vectors tells whether events are ordered or concurrent.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

ABC[1,0,0]

Process A a local event: increment its own counter. Timestamp [1,0,0].

event:
1
1/9

Vector clocks can tell whether two events are ordered or concurrent.

Step by step

  1. 1Each process has a vector
  2. 2Increment own entry on events
  3. 3Merge element-wise on receive
  4. 4Compare vectors

Where it is used

Conflict detection in Dynamo-style stores.

Watch out for

Vectors grow with the number of processes.

Related