You cannot freeze every machine in a distributed system at the same instant without synchronized clocks or a global stop-the-world barrier, yet K. Mani Chandy and Leslie Lamport proved in 1985 that processes can record a meaningful global snapshot mid-flight using just one control token per channel. Published in ACM Transactions on Computer Systems, their algorithm solves a problem that broke earlier deadlock and termination detectors: local machine checkpoints are useless unless they also capture messages still traveling across the network at the cut.
Chandy and Lamport compared the task to photographers shooting a flock of migrating birds stretching across a wide sky. Because no single shutter covers the whole horizon and the birds will not pause in mid-air, each camera snaps locally while markers along FIFO links align the seams. Forty years later, that exact marker-barrier rule powers checkpoints in Apache Flink and streaming engines worldwide.
- Zero global clocks, zero pauses: processes share neither clocks nor memory, and the snapshot protocol runs concurrently without altering or stalling the underlying computation.
- Channels are first-class state: saving only local variables drops or duplicates messages in flight; consistency requires matching send and receive counts across each edge (
n = n'andm = m'). - Two rules, FIFO boundary: after recording local state, each process injects one
markeron every outgoing channel before sending further application messages, and logs incoming messages on other edges until their markers arrive. - Soundness without physical simultaneity: Theorem 1 proves that even if the recorded global state
S*never physically occurred during execution,S*is reachable from initiation stateS_iand termination stateS_phiis reachable fromS*.
Why naive checkpoints duplicate or lose state
To show why independently timed snapshots fail, Section 2.1 introduces the single-token conservation system: two processes p and q connected by directed channels c (p to q) and c' (q to p), passing a single token forever across four global states: in-p, in-c, in-q, and in-c'.
Suppose p records its local state while the system is in in-p, saving “token in p.” Immediately afterward, p sends the token onto channel c, moving the global state to in-c. Now c, c', and q record their states. Channel c shows the token in transit, and the assembled global snapshot reports two tokens in the system (one at p, one in c), an impossible state unreachable from any valid execution. Flip the order (c records empty in in-p, p sends the token, then p, q, and c' record in in-c) and the snapshot shows zero tokens.
Section 3.1 pinpoints the exact arithmetic behind both bugs. For any channel c from p to q, let n be the messages sent along c before p records its state, n' the messages sent before c’s state is recorded, m the messages received before q records its state, and m' the messages received before c’s state is recorded. Consistency demands four equations:
n = n'andm = m': the recorded channel endpoints must agree with both sender and receiver counts (nbelown'creates phantom duplicates;naboven'erases in-flight messages).n' >= m'andn >= m: a channel cannot deliver more messages than were sent before the cut.
When p injects a marker immediately after its nth send along c, FIFO delivery turns the marker into a physical cut line in the message stream. Everything ahead of the marker on c belongs to the sender’s pre-snapshot history (n' = n). When q sees its first marker on c (having not yet snapped its own state), q records its state before processing any further messages on c, locking m = n' = m' so c is empty. On any other incoming channel whose marker arrives later, q logs every application message that arrives after q’s local snapshot and before that channel’s marker, capturing messages (m' + 1) through n' automatically.
A snapshot that never happened, yet always works
The deepest surprise in Chandy and Lamport’s paper arrives in Section 4: the recorded global state S* does not have to be any state the live system actually passed through.
Consider Example 2.2 (Figures 5 through 8). Process p starts in state A and q starts in state C with empty channels (S_0). Process p initiates the snapshot in S_0, records A, and sends a marker down c. Before that marker reaches q, three underlying events fire: p sends M (S_1: p=B, q=C, c=[M]), q sends M' (S_2: p=B, q=D, c=[M], c'=[M']), and p receives M' (S_3: p=A, q=D, c=[M], c'=empty). Only then does q receive p’s marker, record state D and c = empty, and return a marker on c' that causes p to record c' = [M']. The resulting snapshot is S* = (p=A, q=D, c=empty, c'=[M']), a state identical to none of S_0, S_1, S_2, S_3!
Why is S* still completely valid for checkpointing and bug detection? Theorem 1 proves two reachability facts: S* is reachable from the initiation state S_i, and the termination state S_phi is reachable from S*. The proof classifies every event as either prerecording (occurred on a process before it recorded its state) or postrecording (occurred after). Whenever a postrecording event e_{j-1} on p precedes a prerecording event e_j on a different process q, e_{j-1} cannot have sent the message received at e_j, because p already emitted its FIFO marker before e_{j-1} and q would have seen that marker before e_j! Therefore e_{j-1} and e_j commute cleanly. Repeatedly swapping adjacent pairs builds a valid permutation seq' where every prerecording event runs before every postrecording event, placing S* squarely on the execution path between S_i and S_phi.
That reachability theorem immediately solves stability detection in Section 5. A property y is stable if once y(S) becomes true, y(S') stays true for every reachable future state S' (such as “computation has terminated,” “deadlock,” or “the token was lost”). Evaluating definite := y(S*) gives an asymmetric, airtight guarantee:
- If
definite = true, theny(S_phi)is guaranteed true at algorithm termination (becauseS_phiis reachable fromS*). - If
definite = false, theny(S_i)was guaranteed false at initiation (becauseS*is reachable fromS_i); you cannot concludeyis still false when the snapshot finishes.
To guarantee termination in finite time, Section 3.3 requires two liveness assumptions: (L1) no marker sits forever unconsumed in an input channel, and (L2) every process records its state within finite time of initiation, satisfied whenever the communication graph is strongly connected and at least one process starts spontaneously.
Trace the snapshot across four scenarios
Switch through the four tabs below to compare Example 3.1’s broken token snapshots against Example 2.2’s valid “never-occurred” cut and Section 5’s stability-detection rule.
Select a trace (or use Left and Right arrow keys) to compare what breaks naive cuts, how markers fix Example 2.2, and how stable predicates behave.
Recording sender early and channel late invents a duplicate
Example 3.1 (n < n')Process p snapshots while holding the token, sends the token onto channel c, and then c snapshots with the token in flight.
- Why naive cut breaks
- Sends before p's snap (n = 0) are smaller than sends before c's snap (n' = 1), placing the same token in both p and c.
- Paper's mechanism
- Marker-sending rule emits a marker on c right after p records state, locking n = n' = 0 before the token enters c.
- Resulting state
- With markers, q sees the marker before the token arrives, records c = empty, and records the token in q (or c' if forwarded).
- Invariant restored
- Token count stays strictly 1 across every reachable global configuration.
Recording channel early and sender late loses the token
Example 3.1 (n > n')Channel c snapshots empty while the token is still in p, then p forwards the token onto c before recording its own state.
- Why naive cut breaks
- Sends before p's snap (n = 1) exceed sends before c's snap (n' = 0), so neither p nor c shows the token.
- Paper's mechanism
- Because c's state is captured only as messages arriving between receiver q's snap and c's marker, c's cut always tracks p's marker emission.
- Key FIFO condition
- Receiver q cannot receive p's marker ahead of the token, guaranteeing m <= n' and n >= m.
- Recovery lesson
- In streaming engines, dropping an in-flight record at checkpoint boundaries causes silent data loss on restart.
Recording S* = (A, D, empty, [M']) when it never occurred
Examples 2.2 & 4.1In run S0 -> S1 -> S2 -> S3, p snapshots at S0 while q snapshots at S3, assembling a state S* absent from the real run.
- Why naive intuition balks
- Live states were (A,C,0,0), (B,C,M,0), (B,D,M,M'), and (A,D,M,0); none matches S* = (A, D, empty, [M']).
- Paper's mechanism
- Example 4.1 swaps postrecording e0 (p sends M) past prerecording e1 (q sends M') to yield seq': q sends M', p sends M, p receives M'.
- Where S* sits in seq'
- Right after e'0 (q sends M') and before e'1 (p sends M), proving S0 -> S* -> S3 is a valid computation.
- Practical consequence
- Distributed checkpoints do not need synchronized physical time to represent a recoverable cut.
Testing deadlock or termination via definite := y(S*)
Section 5Evaluating a stable predicate y on the recorded snapshot S* gives one-sided certainty across asynchronous delays.
- Why false is subtle
- Seeing definite = false on S* only proves the system was not deadlocked when the snapshot started (S_i); it could deadlock mid-snapshot.
- Paper's mechanism
- Because S* leads to S_phi and y is stable (y(S) implies y(S')), definite = true proves y(S_phi) holds when the check finishes.
- Collection step
- Section 3.3 separates recording from assembly: in strongly connected graphs, processes flood local records along outgoing edges.
- Topology boundary
- If a process has no directed path from any initiator, it never receives a marker unless it starts spontaneously.
Source: Chandy and Lamport (1985), Examples 2.2, 3.1, 4.1, and Section 5.
If you prefer the concise summary without clicking through the tabs, here are the four core behaviors from the paper:
- Two tokens (
n < n'): snapping a sender before its send and a channel after duplicates in-flight messages; markers enforcen = n'. - Zero tokens (
n > n'): snapping a channel before the send and the sender after loses messages; receiver-side capture between local snap and marker arrival prevents drops. - Valid “phantom” cut (
S*): in Example 2.2,S* = (p=A, q=D, c=empty, c'=[M'])never happened in real time, yet Theorem 1 permutes prerecording events ahead of postrecording events soS_0 -> S* -> S_3. - Stability detection (
y(S*)):definite = trueguarantees the stable property holds at termination (S_phi), whiledefinite = falseonly guarantees it did not hold at initiation (S_i).
Assumptions, bounds, and modern stream checkpoints
Three assumptions define where Chandy-Lamport stops and where production engines have to extend it.
First, channels must be reliable, error-free, and strictly FIFO. If UDP packets overtake a marker, or if a process communicates across multiple multiplexed connections without preserving send order, n = n' breaks immediately. Modern systems enforce FIFO per logical edge over TCP or sequence-numbered streams, and ensure every source node initiates spontaneously when graphs are directed DAGs rather than strongly connected rings.
Second, the base algorithm assumes infinite channel buffers and separates state assembly. In Section 2, the authors note that bounded buffers are safe only if no process stalls trying to enqueue into a full buffer, because blocking on a marker violates liveness condition (L1). In modern stream processors like Apache Flink, a slow downstream operator creates backpressure; Flink either pauses alignment on faster channels (buffering their post-marker records) or switches to unaligned checkpoints that serialize in-flight buffers directly, trading checkpoint size for predictable checkpoint latency under backpressure.
Third, internal snapshots do not automatically coordinate external sources and sinks. Chandy and Lamport capture closed distributed computations with no physical clocks (building on the causal event ordering in Lamport’s logical clocks, while staying clear of FLP impossibility because recording requires no consensus). Production pipelines restart from external logs like Kafka and write to external databases, so they pair marker barriers with source offset tracking and two-phase commit sinks, just as consensus logs pair Raft snapshots with client serial numbers for end-to-end safety.
For distributed systems engineers, Chandy and Lamport’s core lesson remains timeless: global state does not require global time. Whenever you need a consistent cut across asynchronous services, do not try to synchronize wall clocks across machines; inject an ordered marker into the data path itself and let FIFO edges draw the boundary for you.


