Skip to content
hashkey.bond

Archivedistributed-systems

Lamport Timestamps and the Illusion of Order

A scalar logical clock preserves causality but cannot tell concurrency from causality.

Published
Reading time
1 min read

Lamport clocks give every event a scalar timestamp such that if a → b then L(a) < L(b). The converse is false: L(a) < L(b) does not imply a caused b.

The rule

local event:      L = L + 1
send:             L = L + 1; attach L
receive(m):       L = max(L, m.L) + 1

Ties are broken by node ID for a total order, which is why distributed logs use (L, node) pairs.

What it is good for

  • Total ordering for replication (state machine replication needs an order, not causality).
  • Cheap causal metadata when you do not need to detect concurrency.
  • Hybrid logical clocks extend the idea with physical time.

What it cannot do

Detect that two events are concurrent. For that you need vector clocks or explicit dependency tracking.

Takeaway: Lamport clocks impose an order; they do not discover one. Use them when any consistent total order is acceptable.