Study order: foundations → cuts → Chandy–Lamport → worked examples → applications. Each complete past-paper question appears after the material needed to answer all its relevant parts. Original question images are included; where a paper combines unrelated course topics, the other parts are identified rather than silently treated as snapshot questions.
Sources: Global Snapshot Part I (I) and Global Snapshot Part II (II). Page numbers below are PDF page numbers.
1. Global state and motivation
A distributed system consists of separate processes that communicate by asynchronous message passing. They have no shared memory or common physical clock. Each process has its own sequence of internal, send, and receive events; events at different processes need not have a single natural ordering (I pp. 2–3, 9).
- Local state : the memory and effects of all events performed by process up to its recording point.
- Channel : a one-way communication path from to . Its recorded state contains messages sent before recorded, but not received before recorded.
- Global state: the collection of all process states and all channel states. A global snapshot records such a collection while computation continues.
Why include messages in transit?
Suppose sends ₹100 to . After the sender deducts the money but before the receiver records its receipt, the money is in transit. Counting only process balances would miss it. Conversely, recording the sender before the debit and the receiver after the credit counts the same ₹100 twice: the recorded receive has no recorded send, so the cut is inconsistent.
In the banking illustration (I p. 4), the initial balances total $800. Recording A at and B and the channels at yields $850, creating an apparent extra $50. The problem is mixing incompatible recording points; account and channel states must be selected consistently.
Banking example: inconsistent recording — Part I, slide 4.
The transit formula
For a message sent from to :
Read this as: all messages whose send is included in the sender’s recorded history and whose receive is not included in the receiver’s recorded history. For example, if records after sending “Hello” and records before receiving it, “Hello” belongs to the recorded channel state. The symbol means “and”; membership of an event in a state is shorthand for its being in that state’s event history (I p. 10).
System model and process events — Part I, slide 9.
Local states and the transit formula — Part I, slide 10.
Why take a snapshot?
- Termination detection: check whether every process is passive and every channel empty; a message in transit could reactivate a process.
- Deadlock detection: inspect distributed wait-for dependencies for deadlock.
- Distributed garbage collection: determine whether distributed references still make an object reachable.
- Counting: include objects held locally and objects in transit, such as tokens or camels moving between zones (I pp. 5–7; II pp. 22–23).
Freezing the whole system is an alternative, but interrupts computation and still requires a coordinated freeze signal. Snapshot algorithms let normal work continue (II pp. 20–21).
Applications of a global snapshot — Part I, slide 5.
Why naive token counting fails
In a ring, asking each process to report its local count at different times can count one moving token once, three times, or zero times: it may visit multiple processes before they report, or be in a channel when they report. A correct solution records a consistent state including channels; the full algorithm and slide execution are in sections 4–5 (I pp. 6–7; II pp. 18–19).
Three possible results of naive token counting — Part I, slide 7.
2. Process histories and communication models
A process history is the ordered sequence of events at . A prefix contains all events up to some chosen boundary; the local state at that boundary results from that prefix. The global history contains all processes’ events (I pp. 9–11, 16).
- FIFO: messages sent on one channel arrive in send order. For example, if is sent before on the same channel, arrives first.
- Non-FIFO: messages on a channel can arrive in a different order.
- Causal delivery: causally related messages delivered to a common receiver are delivered in causal order. FIFO concerns a single channel; causal order can involve messages sent by different processes (I p. 12).
Process history and prefix — Part I, slide 11.
FIFO, non-FIFO and causal communication — Part I, slide 12.
3. Cuts and consistent global states
A cut selects one prefix from each process history. Imagine drawing a line across the process timelines: events to its left belong to the cut; events to its right do not. The frontier is the last included event on each process with a nonempty prefix. For example, if the cut includes the first two events of and the first event of , its frontier consists of the second event of and first event of . The cut includes their entire prefixes, not only those frontier events (I pp. 14–18).
Consistency
A cut is consistent if it includes every causal predecessor of every event it includes:
In particular, a recorded receive must have its send in the cut. A recorded send without its receive is valid: the message is in transit. A cut containing a receive but not its send shows an effect without its cause and is inconsistent. A consistent snapshot represents a causally possible state; the recorded local states need not have existed at the same physical instant (I pp. 13–18; II pp. 2, 7).
Trace each message arrow across the cut. A send in the future and its receive in the past makes the cut inconsistent. A send in the past and receive in the future is an in-transit message.
Message arrows crossing cuts — Part I, slide 15.
Global history, cuts and frontier — Part I, slide 16.
Example cut across three process histories — Part I, slide 18.
Conditions for recording a message
For a consistent global state, each message obeys these rules (I p. 13):
- If its send is recorded, then either its receive is recorded in the receiver’s state or it is in the channel state—not both.
- If its send is not recorded, neither its receive nor the message in the channel may be included in that snapshot.
The practical issues are deciding which messages belong to the snapshot, and ensuring a process records before processing any message sent after its sender recorded. Markers and FIFO channels address these issues (II pp. 3, 8–9).
Conditions for a consistent global state — Part I, slide 13.
Issues when recording a global state — Part II, slide 3.
Runs, linearizations, and progression
A run is a total ordering that preserves each process’s own event order. A linearization is a run that also preserves happened-before: causes precede effects, while concurrent events may be ordered either way. Linearizations pass through consistent global states. In the slide’s execution model, one event changes the state in each transition . If consistent cuts , the snapshot from is more recent (II pp. 4–6).
Runs and linearization — Part II, slide 6.
CT1 2024, Q2 — mixed topics
(a) Timestamp order in Maekawa — 2 marks
- Basic Maekawa’s algorithm does not guarantee that critical-section requests are served in increasing global timestamp order.
- A quorum member may grant its vote to a later-timestamped request before an earlier request reaches it. Unlike Ricart–Agrawala, a requester does not obtain permission from every other process.
(b) Deadlock in Maekawa — 3 marks
- Consider three processes whose voting sets are , , and . These sets intersect pairwise.
- Suppose , and each grant their own vote to their own request. Each still needs the next process’s vote, but every vote is already held.
- None can obtain all required votes or enter and release its votes, so the processes wait indefinitely. Basic Maekawa can therefore deadlock; deadlock-handling extensions use messages such as
INQUIREandYIELD.
(c) Token-based response time — 2 marks
- Let be critical-section execution time and a one-way message delay. Under low load, Suzuki–Kasami takes approximately if the requester already holds the idle token, or if it requests the token from an idle holder.
- Under high load, a process must also wait for requests ahead of it. If full executions are ahead, an illustrative estimate is ; the exact time depends on the token protocol, queue and current token location.
(d) Consistent cut — 3 marks
- A cut selects a prefix of each process’s event history.
- It is consistent if, whenever an event belongs to the cut, every event that happened before it also belongs to the cut. Thus a receive cannot be included without its send.
- This prevents an effect appearing without its cause and makes the recorded state a causally possible global state. A send without its receive is allowed and represents a message in transit.
4. Chandy–Lamport snapshot algorithm
Goal: record process and channel states forming a consistent snapshot while normal computation continues (II pp. 7–12).
Assumptions
The slide model assumes no process or channel failures; messages are delivered intact, exactly once and eventually; channels are unidirectional and FIFO; and each pair of processes has a communication channel. Any process may initiate. More generally, marker reachability and eventual delivery suffice for participation in a suitable directed network; the ring example uses such a network rather than a complete graph.
Chandy–Lamport assumptions — Part II, slide 10.
Marker rules
A marker is a control message, distinct from an application message or token.
- Initiator: records its local state, starts recording each incoming channel, and sends a marker on every outgoing channel before sending later application messages on that channel.
- First marker at another process: record the local state; record the marker’s incoming channel as empty; immediately start recording application messages on all other incoming channels; send markers on every outgoing channel before later application messages.
- Later marker on an incoming channel: stop recording that channel. Its state is the set of application messages received on that channel after the process recorded its local state and before the marker arrived.
- Completion: when every process has recorded and received a marker on each incoming channel, recording is complete. The fragments still need to be collected, for example at the initiator.
Why is the first-marker channel empty? FIFO ensures that every message sent on it before the sender’s marker arrived before the marker, hence before the receiver recorded. Messages sent after the marker arrive later and do not belong to the snapshot.
Marker sending and receiving rules — Part II, slide 12.
Why the algorithm works
- If a message was sent before its sender recorded, FIFO makes it arrive before that sender’s marker. It is either included in the receiver’s recorded local state or recorded as in transit.
- If it was sent after the sender recorded, it follows the marker and cannot be included in the receiver’s snapshot or recorded channel state.
- Thus a recorded receive cannot lack its send, and channel contents match the cut.
- Markers must reach all participating processes and all incoming channels, and processes must continue to execute. Eventual delivery then completes recording. Collection is a separate step (II pp. 14–15).
The slides give control messages and time for recording, where is the number of channels and the network diameter, under their message-delay/timing assumptions. In a fully asynchronous model there is no finite wall-clock bound without a delivery-time bound. Collection is not included.
Correctness and complexity — Part II, slide 15.
Semester 2025, CO2 (iii) — election and Chandy–Lamport assumptions
(a) Election message count — 3 marks
- The question does not name an election algorithm or define its message-counting convention, so it does not determine a unique numerical answer.
- If we assume the single-initiator list-based ring algorithm described in part (c), with 10 live processes and one message counted per hop, process 2 sends an election message around the ring. It returns after 10 message transmissions.
- The initiator selects the highest ID in the returned list. If a separate coordinator message then circulates once to inform everyone, it requires 10 more transmissions, for a total of 20. The leader is identified after 10; all processes learn the result after 20.
- Other ring variants, simultaneous elections, failures or the Bully algorithm can produce different counts. State the chosen assumption in an exam.
(b) Chandy–Lamport assumptions — 3 marks
- Processes communicate through reliable, unidirectional FIFO channels; messages arrive intact, exactly once and eventually.
- No process or communication-channel failure occurs during the snapshot. The slide model assumes a channel between every pair of processes; more generally, markers must reach every participating process.
- Any process can initiate. Processes continue their normal computation while recording; after recording, each sends its marker on an outgoing channel before later application messages on that channel.
(c) Ring election and fairness — 4 marks
- Arrange processes in a logical directed ring, with each process having a unique ID and knowing its successor. An initiator sends an election message containing its ID to its successor.
- In the list-based variant, each live process adds its ID and forwards the message. When it returns to the initiator, the initiator selects the highest ID in the list.
- The initiator circulates a coordinator message naming the winner; each process records the leader and forwards the announcement.
- The message visits every participating process, so each has an opportunity to be represented, assuming reliable delivery and a functioning ring. However, highest-ID selection does not provide equal opportunity or rotation: the highest-ID live process wins repeatedly. Stronger fairness would require an additional policy.
Class Test 1, Q2 — algorithm, assumptions and channel states
Answer — mark allocation not visible in the supplied crop
- The Chandy–Lamport snapshot algorithm records the local state of each process and the state of each channel, producing a consistent global state while normal computation continues.
- Assumptions: channels are unidirectional and FIFO; messages arrive intact, exactly once and eventually; no failures occur during the recording; and the slide model assumes a channel between each pair of processes. Any process may initiate.
- Initiation: the initiator records its local state, starts recording its incoming channels and sends a marker on every outgoing channel before sending later application messages on that channel.
- First marker: a process that has not yet recorded saves its local state, records the channel on which the marker arrived as empty, starts recording all other incoming channels and sends markers on its outgoing channels.
- Recording channel states: when a marker later arrives on an incoming channel, the process stops recording that channel. Its state consists of all application messages received on it after the process recorded its local state and before the marker arrived.
- Completion and collection: after each process has received a marker on every incoming channel, the process and channel states can be collected to form the global snapshot.
- Correctness: FIFO ensures a message sent before the sender’s marker is either reflected in the receiver’s local state or recorded as in transit; a message sent after the marker is excluded.
- The standard Chandy–Lamport algorithm already includes channel recording. If the starting description records only process states, the incoming-channel recording and closing rules above supply the requested extension.
PYQ — CT2 2024 and CT2 2026, Q1: message selection and consistent cuts
(a) Distinguishing messages — 3 marks
- After recording its local state, a process records messages arriving on each incoming channel until the marker for that channel arrives.
- Messages received during that interval are recorded as the channel’s state: they were sent before the sender recorded but received after the receiver recorded.
- A message received before the receiver recorded is already reflected in its local state. FIFO ensures messages sent after the sender’s marker arrive after the marker and are excluded.
(b) Snapshot algorithm and consistent cut — 7 marks
- Initiation: an initiator records its local state, starts recording its incoming channels and sends a marker on each outgoing FIFO channel before sending any later application message there.
- First marker: a process receiving its first marker records its local state, records that incoming channel as empty, starts recording the other incoming channels and sends markers on all outgoing channels.
- Later markers: on a marker for another incoming channel, it stops recording that channel and saves the application messages received on it since its local recording.
- Completion: after a marker arrives on every incoming channel of every process, all local and channel states have been recorded. The fragments may be collected at the initiator.
- Pre-recording send: FIFO places the message before the sender’s marker. It is either included in the receiver’s local state or recorded as an in-transit channel message.
- Post-recording send: the marker precedes the message and therefore reaches the receiver first. The message is excluded from the snapshot.
- Thus no recorded receive can exist without its send, and every recorded in-transit message is accounted for. The selected process histories form a consistent cut.
Result: Record an application message in the channel state exactly when its send is included in the cut and its receive is still outside the cut.
5. Worked slide examples
Three processes and six channels (II p. 13)
Write for the channel from to . In the slide figure above:
- records first, sends markers to and , and records arrivals on and .
- first receives a marker on , records its state, sets , forwards markers and begins recording .
- receives application message on after recording but before that channel’s marker. It records when the marker arrives.
- first receives its marker on and records its state; . It sends markers and records .
- records on before that channel’s marker. The remaining recorded channel states are and . Thus the snapshot contains the three local states and channel states , and four empty channels.
The arrows summarize recorded channel contents; they are not a complete timing diagram. Application messages and were sent before their respective senders recorded, but received after their receivers recorded.
Why the marker rules work
- No message from the future: a sender places its marker before later application messages. FIFO forces the marker to arrive first, so the receiver records its state before accepting such a message into its local snapshot.
- No lost pre-snapshot message: if an earlier message arrives before the receiver records, its effects are in the local state; otherwise it arrives before the marker and is recorded in that incoming channel.
- Termination: markers eventually propagate to every participating process and traverse every incoming channel, assuming reachability, continued execution, and eventual message delivery. Recording and later collection are separate phases.
Semester 2025 — consistent cut and three-process ring
(a) Consistent cut — 3 marks
- A cut selects a prefix of the event history of every process.
- The cut is consistent if it includes every causal predecessor of every event it contains; in particular, a receive cannot be included without its corresponding send.
- A send without its receive is allowed and represents a message in transit. Consistency prevents effects without causes and produces a causally possible global state.
(b) Marker receiving rule and ring execution — 7 marks
- Marker receiving rule: on its first marker, a process records its local state, marks that incoming channel empty, starts recording its other incoming channels and sends a marker on every outgoing channel. On a later marker, it closes that channel and records the messages received on it since its local snapshot.
- Consider the ring , with FIFO channels, and let initiate.
- records , starts recording and sends a marker to before later application messages.
- On its first marker, records , sets and sends a marker to .
- On its first marker, records , sets and sends a marker to .
- When receives this marker, it closes . Any application messages received there after recorded and before the marker form .
- The result is . FIFO makes the cut consistent. Exact channel contents depend on the message timings; collect these fragments to assemble the snapshot.
Trading (II pp. 16–17)
Initially holds $1000 and no widgets, and holds $50 and 2,000 widgets; both channels are empty.
- sends an order carrying $100; its balance becomes $900. The order is in the channel, ahead of marker .
- separately sends five widgets, reducing its stock to 1,995. The widgets are in the reverse channel until received.
- When receives them it holds five widgets and that channel becomes empty. These are successive execution states shown on the slides, not automatically the final snapshot. They illustrate why travelling money, orders, or goods must be included.
Trading example: initial state — Part II, slide 16.
Trading example: execution states — Part II, slide 17.
Counting a token in a ring (II pp. 18–19)
Consider . The example starts the send/receive counters at zero, and one token moves as follows. “Turns red” in the slides means a process has recorded its state.
- sends the token to , records , , , then sends a marker to . It records arrivals on its incoming channel until its marker returns.
- receives and forwards the token to before receiving the marker. On the marker it records , , , then sends a marker to .
- receives and forwards the token to before receiving its marker. On the marker it records , , , then sends a marker to .
- receives the token and then the marker. The token arrived after recorded and before the marker, so it is recorded in .
For each channel, recorded sends minus recorded receives gives its token count at the cut:
| Channel | Recorded sends | Recorded receives | In transit |
|---|---|---|---|
| 1 | 1 | 0 | |
| 1 | 1 | 0 | |
| 1 | 0 | 1 |
Thus . The system continued running; this is the token’s location in the recorded global state, not necessarily its location when collection finishes. In general, sent/received counters must cover the same history and account for initial channel contents.
Counting tokens: steps 1–4 — Part II, slide 18.
Counting tokens: steps 5–6 and total — Part II, slide 19.
Semester 2025, CO1 — counting tokens
Answer — mark allocation not visible in the supplied crop
- A naive solution asks every process for its current local count and adds the replies. This can double-count a token that moves between reporting processes or miss a token travelling in a channel.
- A correct count is possible under the snapshot assumptions: the ring has reliable FIFO channels, messages are eventually delivered, and tokens are neither created nor destroyed during the count.
- An initiator records its local token count, begins recording its incoming channel and sends a marker on its outgoing channel before later token messages.
- On receiving its first marker, each other process records its local token count, records that incoming channel as empty and forwards the marker before sending subsequent tokens.
- When the marker returns to the initiator, it closes its incoming-channel recording. Tokens received there after the initiator recorded and before the marker are recorded as in transit.
- Each process reports its recorded local and incoming-channel counts to the initiator. Add all local counts and all channel counts to obtain the total; normal token movement need not stop.
- In the slide execution, the local counts are , and the channel counts are , and . Hence the total is .
- If recorded send and receive counters are used to compute channel counts, they must cover the same history and account for any tokens initially in a channel.
6. Collection and applications
After recording, each process may send its fragment to the initiator. Alternatively, fragments can be flooded through outgoing channels with duplicate suppression; if the graph is strongly connected and messages eventually arrive, every process can reconstruct the global state (II p. 14).
For termination, a consistent snapshot with all processes passive and all channels empty proves termination if no external work can arrive. One passive process alone is not enough: an in-transit message might activate it. The same snapshot principle supports distributed garbage collection, deadlock analysis and counting camels moving between satellite zones (I p. 5; II pp. 22–23).
Termination of recording and state collection — Part II, slide 14.
Application: counting camels — Part II, slide 22.
Past-paper questions: applications and combined topics
Semester 2024, CO2 — local/global state and termination
(a) Local state and global state — 5 + 5 marks
-
A distributed system consists of separate processes communicating by messages, without shared memory or a common physical clock.
-
The local state of process consists of its local memory and the effects of all events it has performed up to its recording point. Events can be internal, send or receive events.
-
For example, a bank process’s local state may include its account balance and the transfers it has already processed.
-
The state of channel contains messages sent by before its recording but not received by before its recording; these are messages in transit.
-
The global state combines the local states of all processes and the states of all channels:
-
For example, if has sent money and has not yet received it at their respective recording points, the money appears in the channel state. Omitting it would make the total appear too small.
-
A consistent global state never includes a message’s receipt without its send. Arbitrarily recording processes at different times may violate this condition.
(b) Snapshot recording for termination detection — 10 marks
- A process is active if it has work to perform and passive if it has no work and is waiting. A passive process may become active again when it receives an application message.
- The system has terminated when every process is passive and every communication channel is empty, assuming no external work can arrive and passive processes do not spontaneously generate work.
- Local observation is insufficient: all processes may appear passive while a message is in transit and could later activate its receiver.
- An initiator starts a Chandy–Lamport snapshot by recording its local state, recording incoming channels and sending markers on its outgoing FIFO channels.
- On its first marker, each process records whether it is active or passive, marks that incoming channel empty and forwards markers. It records messages arriving on its other incoming channels until their markers arrive.
- When markers have arrived on all incoming channels, the recorded process and channel states are collected at an initiator or another detector.
- The detector checks the snapshot: every recorded process must be passive and every recorded channel must be empty.
- If both conditions hold, no internal message is available to reactivate a process; with no external work or spontaneous activity, the system is terminated.
- If any process is recorded active or any channel contains a message, this snapshot does not establish termination. The detector may take another snapshot later.
- The snapshot must be consistent so that a message is neither lost nor counted inconsistently between process and channel states. Recording can occur while the computation continues.
Semester 2025, CO2 — channels, recording issues and frontier
(a) Role of channels — 2 marks
- Channels carry application messages and snapshot control messages between processes.
- A channel’s recorded state contains messages sent before the sender recorded but not received before the receiver recorded. These messages are in transit in the snapshot.
- Recording them prevents a message or transferred resource from being omitted between the two local states.
- In Chandy–Lamport, FIFO ordering ensures the marker separates messages sent before the sender recorded from those sent afterward.
(b) Issues before recording a global state — 3 marks
- Processes have no shared global clock, so their local recording instants must be coordinated to avoid incompatible states.
- A message sent before its sender records must be represented either by its receipt in the receiver’s local state or as an in-transit message in the channel state, but not both.
- A message sent after its sender records must be excluded from both the receiver’s recorded state and the recorded channel state.
- In particular, the receiver must record before processing a message that was sent after the sender recorded; otherwise the cut could contain a receive without its send.
- FIFO markers provide the separation needed to satisfy these conditions.
(c) Frontier of a cut — 2 marks
- A cut selects a prefix of the event history of each process.
- Its frontier is the set of the last included events on the processes with nonempty prefixes; it marks the boundary of the cut.
- For example, let have events and have events . If a cut includes at and at , its frontier is .
- The complete cut is ; the frontier contains only the boundary events, not all earlier events.
(d) Highest-ID candidate fails before declaring itself — 3 marks
- The question does not specify the election protocol or failure detector. Under a Bully-algorithm interpretation, a waiting process uses a timeout to suspect that the higher-ID candidate has failed.
- It starts or restarts an election by sending
ELECTIONmessages to higher-ID processes. Responding higher-ID processes also participate in the election. - The highest-ID process that is still alive and receives no reply from a higher process announces itself using
COORDINATORmessages. This relies on suitable timing and failure-detection assumptions; a timeout alone is not reliable in a fully asynchronous system.
Semester paper printed 2023 (file named 2022), CO2 — timing, asynchrony and a snapshot application
Local and global timing — 5 marks
- A local clock belongs to an individual process and helps it measure time or order its own events.
- Different physical clocks can drift and may not show the same time, because distributed processes lack a perfectly shared clock.
- Global physical timing aims to relate events at different processes to a common time scale, usually through clock synchronization; synchronization is subject to error and communication delays.
- Logical clocks provide timestamps consistent with causality without requiring physical clocks to agree. If event happened before , Lamport timestamps satisfy .
- The reverse does not necessarily follow for Lamport timestamps: a smaller timestamp alone does not prove causality. Vector clocks can distinguish causality from concurrency.
Handling asynchrony — 5 marks
- In an asynchronous system there is no known fixed upper bound on process execution speed or message delivery time.
- A process cannot infer from a delayed reply alone whether another process has failed or is merely slow.
- Distributed algorithms coordinate through messages and explicitly defined event ordering rather than assuming simultaneous actions or a shared clock.
- Logical timestamps, acknowledgements and protocol rules can establish ordering and coordinate operations; FIFO markers are one example used in snapshot recording.
- Safety must hold despite arbitrary delays. Progress requires suitable assumptions, such as eventual message delivery and processes that continue executing; failure handling needs additional assumptions or mechanisms.
Application: termination detection — 6 marks
- A process is passive when it has no work, but an in-transit message can later make it active again.
- The snapshot initiator records its local state and sends markers. On a first marker, each process records its activity state and forwards markers.
- Each process records the messages arriving on an incoming channel after its local snapshot and before that channel’s marker; the resulting channel state captures messages in transit.
- Collect the recorded process and channel states to form a consistent global snapshot.
- If every process is passive and every channel is empty, there is no internal work or message left to reactivate a process. Assuming no external work or spontaneous activity, the computation has terminated.
- If a process is active or a channel contains a message, the snapshot does not establish termination; another snapshot may be taken later.

































