PAPER EXPLAINED
Time, Clocks, and the Ordering of Events in a Distributed System
IntermediateAbout 51 min to read the paper
TL;DR
Lamport defines a 'happened before' partial order on events in a distributed system. He shows how simple logical clocks extend it to a total order usable for synchronization, then adapts the rules to physical clocks and proves a skew bound.
What problem does Lamport Clocks solve?
Processes in a distributed system are separated and talk only through messages whose delays are not negligible. Intuitive notions like 'request A came before request B' rest on physical time, but real clocks are imperfect, and the system can only observe its own events. Sometimes neither of two events can be said to come first. Without a clear notion of order, it is hard even to specify synchronization requirements. A naive central scheduler can grant requests unfairly, because messages can arrive in an order different from the order of causation.
The core idea
Define order by possible causation rather than by wall-clock time. One event happened before another if they occur in order in one process, if one sends a message the other receives, or by chaining those two cases. This yields only a partial order. Each process keeps a counter. It ticks between events, stamps outgoing messages, and jumps ahead of any timestamp it receives. The counters then respect causation. Sorting events by counter value, with ties broken by a fixed process ranking, gives one total order that every process can compute independently. That shared order is enough to build distributed synchronization. Physical clocks following similar rules can also keep user-visible order consistent.
IN THE AUTHORS’ WORDS
“In a distributed system, it is sometimes impossible to say that one of two events occurred first.”
Time, Clocks, and the Ordering of Events in a Distributed System, p. 1
“Without physical time, there is no way to distinguish a failed process from one which is just pausing between events.”
Time, Clocks, and the Ordering of Events in a Distributed System, p. 5
“In a distributed system, it is important to realize that the order in which events occur is only a partial ordering.”
Time, Clocks, and the Ordering of Events in a Distributed System, p. 7
How Lamport Clocks works
- Treat each process as a sequence of events, with sending and receiving messages counted as events. Define 'happened before' as the smallest relation that covers same-process order and send-to-receive pairs, and is transitive. Events unrelated in either direction are concurrent.
- Require logical clocks to satisfy the Clock Condition: if a happened before b, then C(a) < C(b). This follows from two conditions. C1: clocks increase along a process. C2: a message's send time is less than its receive time.
- Implement the clocks with two rules. IR1: increment the local clock between successive events. IR2: stamp each message with the sender's clock, and on receipt advance the local clock past that timestamp.
- Build a total order: a precedes b if a's timestamp is smaller, or if the timestamps are equal and a's process ranks lower in a fixed process ordering. This extends the partial order but depends on the choice of clocks, so it is not unique.
- Solve mutual exclusion with no central process. Requests are broadcast and timestamped, every process queues them and sends acknowledgments, and releases are broadcast. A process takes the resource when its request is first in its queue and it has heard later-timestamped messages from all others.
- Generalize the approach: each process simulates the same state machine, executing commands in timestamp order once it has learned of all earlier commands. This can implement any desired synchronization, but it needs every process to participate.
- For physical clocks, assume the clock rate stays within κ of the true rate. Adapt the rules (IR1', IR2') so that on receipt a clock is set to the maximum of its current value and the timestamp plus a known minimum delay, never setting it back. Then derive a bound on the skew between any two clocks.
Results
The paper shows that rules IR1 and IR2 guarantee the Clock Condition, giving a correct system of logical clocks. It argues that the timestamp-based mutual exclusion algorithm meets its three conditions: exclusive use, grants in request order, and eventual granting. For physical clocks, it shows anomalous behavior is impossible if ε/(1−κ) ≤ μ, where μ is less than the shortest interprocess transmission time. The main theorem bounds clock skew at roughly d(2κτ + ξ) once t ≥ t0 + τd. This relies on approximations assuming μ + ξ is much smaller than τ, but relation (11) of the proof gives an exact bound otherwise. The paper notes κ ≤ 10^-6 for typical crystal clocks. The results are proofs and arguments, not experiments.
Limitations and what came later
- The state machine approach requires every process to participate, so one failed process halts the system. The paper explicitly leaves failure handling out of scope.
- The mutual exclusion algorithm assumes in-order delivery between each pair of processes, eventual delivery of every message, and direct communication between all processes. The author says message numbers and acknowledgments could remove the first two assumptions.
- The total order produced by logical clocks is somewhat arbitrary and can disagree with the order users perceive when causation passes through channels outside the system.
- The physical clock analysis assumes Newtonian space-time, continuous clocks, bounded drift and regular message exchange. The headline skew bound is approximate and relies on μ + ξ being much smaller than τ.
- The paper promises, rather than provides, the extension to arbitrary synchronization problems, and calls the precise state machine algorithm straightforward without spelling it out.
Why Lamport Clocks matters
The paper gives a precise vocabulary for reasoning about order in any multiprocess system: happened-before, concurrency, logical timestamps and the Clock Condition. It shows that agreeing on one order of events is enough to coordinate processes without a central authority, and that the same idea can drive replicated state machines. It also clarifies where purely logical time falls short, namely interaction with the outside world and failure, and when physical clocks are needed.
This paper shows that in a system of separate computers exchanging messages, you often cannot say which of two events came first. It turns that observation into a precise tool. From a single relation, 'happened before', it builds logical clocks: plain counters that need no real timekeeping but still respect cause and effect. Those clocks yield one agreed order of all events. The paper then uses that order to solve distributed mutual exclusion without a central coordinator, and sketches how the same approach lets every process simulate a shared state machine. It also explains when logical order can surprise users and how synchronized physical clocks prevent this, proving a bound on clock skew. The text is short, and most of it is readable with little math. Only the appendix proof is heavy. The ideas apply to any multiprocess system, not just networks, so it is a strong foundation for reasoning about concurrency and ordering.
Before you read
Who it’s for
Software engineers, students and researchers working with distributed or concurrent systems who want a precise, first-principles account of event ordering, logical timestamps and clock synchronization.
What to know first
- Basic idea of processes communicating by sending messages
- Comfort with relations and orderings (partial vs. total order, transitivity)
- Familiarity with the mutual exclusion problem in concurrent programming
- Basic inequalities and derivatives, for the physical clocks section and appendix
Glossary
- Happened before (→)
- The smallest relation on events covering same-process order and send-to-receive pairs, closed under chaining. It means one event could causally affect another.
- Concurrent events
- Two distinct events where neither happened before the other, so neither can causally influence the other.
- Logical clock
- A function, which can be just a counter, that assigns a number to each event in a process, with no assumed link to physical time.
- Clock Condition
- The correctness requirement for logical clocks: if a happened before b, then a's timestamp is less than b's.
- Total ordering (⇒)
- An ordering of all events by timestamp, with ties broken by a fixed ranking of processes. It is consistent with happened-before but not unique.
- Anomalous behavior
- When the system's event order contradicts an order caused by events outside the system, such as a phone call between users.
- Strong Clock Condition
- A stricter requirement that timestamps respect happened-before including relevant external events, not just system events. Logical clocks generally do not satisfy it.
- State Machine
- A set of commands, a set of states and a transition function. Each process simulates it, using timestamp order to apply the same command sequence.
- Unpredictable delay (ξ)
- The part of a message's total delay above the known minimum delay that the receiver can assume.
- Diameter (d)
- The smallest number such that any process can reach any other through at most d direct communication arcs.
What to pay attention to
- The definition of 'happened before' on page 2 uses only messages that were actually sent, not ones that could have been sent.
- Why the Clock Condition is one-directional: the converse would force all concurrent events to share a timestamp (page 3).
- How the tie-breaking rule by process order turns timestamps into a total order, and why that total order is not unique (page 4).
- The counterexample showing that a central scheduler granting requests in arrival order can violate fairness (page 4).
- Rule 5 of the mutual exclusion algorithm: both conditions are checked locally, and condition (ii) relies on in-order delivery (pages 4-5).
- The remark that failure only makes sense with physical time, and that the state machine approach halts if one process fails (page 5).
- The 'anomalous behavior' example with a phone call outside the system, and the Strong Clock Condition (page 5).
- The rule that physical clocks are only ever set forward, never back, which the author says sets this theorem apart (pages 6-7).
Questions to keep in mind
- Why can't the system determine physical-time order between two events in different processes using only its own events?
- What exactly does a logical timestamp guarantee, and what does it not guarantee about two events?
- Why does the mutual exclusion algorithm need an acknowledgment from every other process before granting the resource?
- How does the external phone call in the anomaly example break the link between user-perceived order and system order?
- What role does the graph diameter d play in the bound on how far physical clocks can drift apart?
Lamport Clocks quiz: check your understanding
1. When are two distinct events a and b called concurrent?
Show the answer
When neither happened before the other: a does not happen before b, and b does not happen before a. Neither event can causally affect the other.
2. What are the two implementation rules that make logical clocks satisfy the Clock Condition?
Show the answer
IR1: each process increments its clock between any two successive events. IR2: every message carries a timestamp equal to the sender's clock when it was sent. On receipt, the receiver sets its clock to at least its current value and greater than the message's timestamp.
3. Why does a central scheduler that grants requests in arrival order fail to meet condition II (requests granted in the order made)?
Show the answer
P1 might send a request to the scheduler P0 and then a message to P2. P2 then sends its own request to P0. P2's request could arrive at P0 before P1's, so P0 would grant P2 first even though P1's request happened before it.
4. In the distributed mutual exclusion algorithm, when is process Pi granted the resource?
Show the answer
Two conditions must both hold. First, Pi's request is ordered before every other request in its local queue under the total ordering. Second, Pi has received a message from every other process timestamped later than its request. Both are checked locally.
5. What is 'anomalous behavior' in this paper, and what are the two proposed remedies?
Show the answer
It happens when the system's timestamp order contradicts an order caused by events outside the system. For example, a person issues request A, then phones a friend who issues request B, and B gets the lower timestamp. One remedy is for users to pass timestamps along explicitly, so B is given a timestamp later than A. The other is to use physical clocks that satisfy the Strong Clock Condition.
6. What bound does the theorem give on clock synchronization, and under what assumptions?
Show the answer
PC2 holds with epsilon approximately d(2κτ + ξ) for all t ≥ t0 + τd. The assumptions are: a strongly connected process graph of diameter d that obeys IR1' and IR2'; minimum delays bounded by μ; clock rates within κ of 1; and a message with unpredictable delay below ξ sent over every arc every τ seconds. The approximation also assumes μ + ξ is much smaller than τ.
7. Why does the state machine approach to synchronization stop working if one process fails?
Show the answer
Each process can execute a command only after learning all commands from other processes with smaller or equal timestamps. If one process fails, no one can be sure they have heard everything from it, so no process can execute commands and the system halts.
Go a little deeper
The paper argues that failure is only meaningful with physical time, since a crashed process looks the same as a slow one. How would you add failure detection or fault tolerance to the timestamp-based state machine approach, and which of the paper's assumptions would you have to give up or strengthen?
Read next
Related reading lists
Cite Lamport Clocks
Lamport, L. (1978). Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM. https://doi.org/10.1145/359545.359563
@inproceedings{lamport1978time,
title = {{Time, Clocks, and the Ordering of Events in a Distributed System}},
author = {Leslie Lamport},
year = {1978},
booktitle = {Communications of the ACM},
doi = {10.1145/359545.359563},
url = {https://lamport.azurewebsites.net/pubs/time-clocks.pdf}
}Study Lamport Clocks in ReadingTrack
Add the paper to your ReadingTrack library with its authors, venue and year, and get this page’s quiz as suggested review cards. You choose which cards to keep; nothing enters your reviews until you accept it.