Happens-Before Relation

The happens-before relation is a way of ordering events in a distributed system based on cause and effect rather than on a shared physical clock. Leslie Lamport defined it in his 1978 paper “Time, Clocks, and the Ordering of Events in a Distributed System.”

The definition has three parts. First, if two events occur in the same process, the earlier one happens before the later one. Second, if one process sends a message and another receives it, the send happens before the receive. Third, the relation is transitive: if A happens before B and B happens before C, then A happens before C. Anything built from these rules captures every way one event could possibly have influenced another.

A crucial feature is that happens-before is a partial order, not a total order. Many pairs of events are not related at all: if neither A happens before B nor B happens before A, the two events are called concurrent. Concurrent events have no causal connection, so the system is free to treat them as happening in any order without violating correctness.

This relation is the conceptual core of much of distributed systems theory. Logical clocks were designed to produce timestamps consistent with happens-before, vector clocks were designed to capture it exactly (including telling concurrency apart from causal order), and consistency models such as causal consistency are defined directly in terms of it.

Sources

Last verified June 8, 2026