Lamport Clocks and the Happened-Before Relation

Assign logical timestamps to local and message events and prove the one-way implication from causality to clock order.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Update when information arrives
  2. Increasing timestamps are a necessary condition for causality

Update when information arrives

A process advances its scalar counter on a local event and includes the value when sending a message. On receipt of timestamp \(t\), it sets its counter to \(\max(c,t)+1\). If a sender’s clock is five and the receiver’s is already eight, the receive event receives nine. Its timestamp exceeds both the earlier local event and the send event.

Increasing timestamps are a necessary condition for causality

Every local or send-to-receive edge increases the clock, so any causal chain also increases it. Two completely independent events can nevertheless receive one and two. Scalar timestamps alone cannot distinguish that case. Adding process identifiers as tie-breakers imposes a total order compatible with causal edges but introduces an arbitrary order among concurrent events. Vector clocks encode richer information. Consistent snapshots reason about which events can be included together.[1]

References

  1. Leslie Lamport, Time, Clocks, and the Ordering of Events in a Distributed System ↩