Implement Lamport Clocks

logical clocks and total order

Challenge 4 of Partitioning & ReplicationIntermediate~45 min

Order events across machines with no synchronized wall clock. Build Lamport's logical clock, a counter that ticks on every local event, rides along on every message, and jumps forward on receipt, then use it to impose a consistent total order over a distributed system. The foundation of causality tracking behind vector clocks, version vectors, and distributed databases.

4 steps

  1. 1The Logical Clock
  2. 2Sending a Message
  3. 3Receiving a Message
  4. 4A Consistent Total Order
Start step 1