▶ Interactive Lab

Vector Clocks

Three processes exchanging messages — see vector clock updates and concurrency detection.

Advertisement
Three processes. Each event/message bumps the vector clock. Watch causality.

What you're seeing

Each process P maintains a vector clock V[P], a counter per process. On a local event: V[P] += 1. On send: include current V. On receive: V = max(V, V_received); V[P] += 1.

Two events A and B are concurrent iff neither V_A ≤ V_B nor V_B ≤ V_A. Otherwise one causally precedes the other. This distinguishes "happened before" from "happened at the same time".

★ KEY TAKEAWAY
Vector clocks distinguish 'happened before' from 'concurrent'. Each message updates the receiver's vector by max(self, sender) + 1.
▶ WHAT TO TRY
  • Click Random local event a few times for each process.
  • Click Random send to see receivers merge vector clocks.