Time, Clocks, and the Ordering of Events in a Distributed System
Without a shared clock, order is causality — and a counter can capture it.
When two computers can’t agree what time it is, how do you decide which event happened first? Lamport’s answer: forget the clock — follow the messages.
The big idea
In a single computer, time is easy: one clock, one ticking order. But a distributed system — many computers talking over a network — has no shared clock, and the messages between them take an unpredictable amount of time. So you genuinely cannot always say which of two faraway events came first. Worse, every machine’s clock is slightly off, so you can’t just trust the timestamps.
Lamport’s move was to give up on measuring real time and instead capture cause and effect. One event “happened before” another if it could have influenced it — either it came earlier on the same machine, or it sent a message that the other event received. He then gave each machine a simple counter — a “logical clock” — with two rules: tick it up on every event, and when you receive a message, jump your counter ahead of the sender’s. That tiny trick guarantees that if A really could have caused B, then A’s number is smaller than B’s.
How it came about
In the 1970s, computers were just beginning to be wired together into networks, and engineers kept tripping over the same confusion: events on different machines seemed to happen “at the same time,” or in an order that made no sense. Lamport, then at Massachusetts Computer Associates, was reading a database protocol by Paul Johnson and Robert Thomas that used timestamps to order operations — and he noticed it could behave strangely.
The flash of insight came from physics. Lamport had studied special relativity, where there is also no universal “now” — the order of two distant events can depend on the observer, and only cause-and-effect (what could send a signal to what) is absolute. He realised a distributed computer system is exactly the same situation, and that the relativity way of thinking solved it. He credits the original timestamp idea, and the notion of “anomalous behavior,” to Johnson and Thomas in the paper’s acknowledgments.
Why it mattered
This eight-page paper became one of the most cited in all of computer science. It gave the field its basic vocabulary — “happened before,” “concurrent,” “logical clock” — and a dead-simple algorithm that still runs inside databases, messaging systems, and collaborative apps today. It also drew the line that the rest of distributed computing would explore: causality is real and fixed, but a single global order is something we impose for convenience, not something the universe hands us.
A way to picture it
Imagine a group chat where everyone’s phone clock is wrong, so you can’t trust the timestamps. How do you still know the order? By the replies. If a message quotes or answers an earlier one, it must have come after it — that’s a real “happened before.” But two people typing at the same moment, neither having seen the other’s message, are “concurrent”: there’s no true order between them, and any order you pick is just a tidy convention. Lamport’s counter is exactly the reply-number that keeps this straight.
Where it sits
This sits at the headwaters of distributed computing. Before it, “time in a network” was a muddle; after it, the field had a rigorous footing. Lamport went on to the Byzantine generals problem (how to agree when some machines lie) and the Paxos consensus protocol — work that earned him the 2013 Turing Award. His way of thinking now lives in the databases behind your bank, in Google’s globe-spanning Spanner, and in the shared documents you and a friend edit at once. It belongs beside Turing and Shannon in this Library as a cornerstone of computer science.
Abstract
Introduction
The Partial Ordering — “happened before”
Logical Clocks — the Clock Condition
Clock Condition. For any events a, b: if a → b then C(a) < C(b).