Distributed Logical Time
Logical clocks encode dependencies rather than elapsed time. Vector clocks detect concurrency under their model, while hybrid clocks attach an approximate physical component.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 3
- Reading time
- 1 min
In this article3 chapters
The causal order is generated by events
Within each process, event order contributes edges. Sending a message precedes its receipt. Transitive closure gives happens-before. A Lamport clock increments locally and advances beyond a received timestamp. It guarantees
\[ a\to b\quad\Longrightarrow\quad L(a)<L(b). \]
The reverse implication need not hold. Two independent processes can use different counter values without communicating. Breaking ties by process identifiers can provide a total order extending causality, while adding comparisons that are not causal dependencies.
Lamport clocks provide a compact order compatible with causal edges. Vector clocks retain more information by identifying which event histories are incomparable.
A vector can distinguish concurrently generated histories
Start two processes at zero. After one event each, their vector timestamps are \((1,0)\) and \((0,1)\). Neither is componentwise below the other, revealing concurrency. If the second process then receives the first event’s timestamp, it takes a componentwise maximum and increments its own component, obtaining \((1,2)\). The message makes the first event a predecessor. Exact vector-clock reasoning assumes specified participant identities and update rules, with a component cost that grows with membership.
Hybrid clocks combine causality with approximate physical time
A hybrid logical clock associates a physical-like component with a logical tie-breaker. It avoids stepping backward by comparing local physical time, the last local timestamp and an incoming timestamp, increasing the logical component when the largest time repeats. Its pair can preserve causal order even while physical clocks disagree. Uncertainty bounds still matter when a protocol relates timestamps to real time. Compare causal storage, timing in consensus, and ordering requirements of distributed transactions.[1][2][3]