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' and m = m').
  • Two rules, FIFO boundary: after recording local state, each process injects one marker on 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 state S_i and termination state S_phi is reachable from S*.
The Chandy-Lamport snapshot rules and channel invariant
1. System model
Directed graph of processes and error-free, infinite-buffer FIFO channels.
Arbitrary finite delay
Channel state equals the sequence of messages sent along c minus those already received.
2. Marker-sending rule
Executed by process p immediately upon recording state.
Enforce n = n’ on every outgoing edge
Send one marker along every outgoing channel c before sending any further application messages.
3. Marker-receiving rule
Executed by receiver q when a marker arrives on c.
First marker snaps q; later markers close channels
If unrecorded, snap q and record c as empty; else record c as messages received between q’s snap and c’s marker.

Algorithm specification from Chandy and Lamport (1985), Sections 2 and 3.2.

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' and m = m': the recorded channel endpoints must agree with both sender and receiver counts (n below n' creates phantom duplicates; n above n' erases in-flight messages).
  • n' >= m' and n >= 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.

Three ways uncoordinated distributed snapshots break
Late channel capture (n < n’)

Sender p snaps before sending the token and channel c snaps after, inventing two tokens out of one.

Early channel capture (n > n’)

Channel c snaps empty before p sends, and p snaps after sending, erasing the token completely.

Non-FIFO channel

If a post-snapshot message overtakes a marker, receiver q logs a future message as in-flight and corrupts the cut.

Counterexamples and channel equations from Chandy and Lamport (1985), Sections 2 and 3.1.

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, then y(S_phi) is guaranteed true at algorithm termination (because S_phi is reachable from S*).
  • If definite = false, then y(S_i) was guaranteed false at initiation (because S* is reachable from S_i); you cannot conclude y is 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.

Four execution traces through Chandy-Lamport snapshots

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.

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 enforce n = 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 so S_0 -> S* -> S_3.
  • Stability detection (y(S*)): definite = true guarantees the stable property holds at termination (S_phi), while definite = false only 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.