Tensorum

Time, Clocks & Ordering

There is no global clock — so how do we know what happened first?

Distributed SystemsAdvanced6 hrs4 key ideas · 5 applied designs
0%
your progress

Overview

There is no global clock — so how do we know what happened first?

Key ideas

  • Physical clocks drift; NTP narrows but never removes the uncertainty.
  • Lamport clocks give a total order consistent with causality; vector clocks detect concurrency.
  • Hybrid logical clocks combine wall-clock readability with causal guarantees.
  • Spanner's TrueTime exposes clock uncertainty and waits it out to get external consistency.

Trade-offs

  • Vector clocks grow with the number of writers.
  • Total-order broadcast is equivalent to consensus — it is never free.

In the real world

CockroachDB HLCsSpanner TrueTimeGoogle Docs operational transforms

Keywords

Lamport clocksVector clocksHLCTrueTime