Logical Clocks
Summary: A mechanism for ordering events in a distributed system based on their causal relationship rather than the time of day.
Sources: chapter8, chapter9
Last updated: 2026-04-18
In a distributed system, unreliable-clocks (time-of-day clocks) cannot be used to reliably order events because they can drift or jump. Logical clocks provide an alternative that is consistent across all nodes.
Types
- Lamport Timestamps: A simple counter that is incremented with each event and passed between nodes. It provides a total ordering of events consistent with causality (source: chapter9, p. 344).
- Version Vectors: A collection of counters (one per node) that can detect concurrent updates and causal relationships (source: chapter5, p. 185).
Key Characteristics
- Relative Order: Logical clocks only care about which event “happened-before” another, not the exact physical time (source: chapter8, p. 290).
- No Synchronization Required: Unlike NTP, logical clocks are updated based on event propagation rather than a central time source.
- Comparison: Lamport timestamps generate a total order but cannot distinguish between causal and concurrent events, whereas version vectors can (source: chapter9, p. 345).