It's Not About "When", It's About "Order"
Since physical clocks are unreliable for ordering fine-grained events across machines, we need a different approach. The key insight, formalized by Leslie Lamport in his 1978 paper "Time, Clocks, and the Ordering of Events in a Distributed System," is this:
In most distributed algorithms, we don't care what time an event happened. We only care whether one event causally influenced another.
This is the happened-before relationship, written as →. We say A → B (A happened before B) if any of the following are true:
- A and B are on the same process, and A occurred before B in that process's execution.
- A is the sending of a message, and B is the receipt of that same message.
- There exists some event C such that
A → CandC → B(transitivity).
If neither A → B nor B → A, then A and B are concurrent — they have no causal relationship. Neither caused the other.
This framework lets us reason about ordering without any physical clocks at all. The question shifts from "what time did this happen?" to "could this event have influenced that one?"