Skip to content
SEE Exam Prep

Question 2 of 15 · CIE-2 QB · Set 2 · 6 marks

Open in ChatGPT

Compare checkpointing and message logging techniques in terms of recovery mechanisms, advantages, and limitations.


Introduction

After a failure a process must be restarted at a state that is consistent with the rest of the system. Two techniques provide that state: saving it periodically (checkpointing) and recording the inputs it received (message logging).

Checkpointing

  • Mechanism: each process periodically writes its state to stable storage. On failure it restarts from the latest checkpoint.
  • In a distributed system the checkpoints must form a consistent cut: a message must not be recorded as received unless its send is recorded.
  • Coordinated checkpointing uses a two-phase protocol so every process checkpoints at the same logical instant.
  • Advantages: recovery is simple: restore the last checkpoint.
  • Limitations: the cost is proportional to state size, and coordinated checkpoints stall the system.

Message logging

  • Mechanism: each process logs every message it receives, in order, to stable storage (or to volatile memory with periodic flushing). On failure it restarts from a checkpoint and replays the log.
  • Piecewise deterministic assumption: a process's state is determined by its checkpoint plus the messages it received since.
  • Advantages: checkpoints can be taken independently and asynchronously, and recovery replays only the messages after the last checkpoint.
  • Limitations: every message is written to stable storage, which is expensive; the logging must handle orphans (a message whose sender is rolled back).

Comparison

Point Checkpointing Message logging
What is saved Process state Received messages
Coordination Needs consistent cut Independent checkpoints
Cost Proportional to state Proportional to messages
Recovery Restore and continue Restore and replay
Failure during recovery Retry from checkpoint Replay log again

Example

A bank's transaction server checkpoints every minute and logs every incoming request. On a crash it restarts from the checkpoint and replays the requests logged after it, so neither the work nor the ordering is lost.

Conclusion

Checkpointing saves the state and is simple to recover from; message logging saves the inputs and allows independent checkpoints. Real systems combine them: periodic checkpoints to bound the replay, and logging to make the replay exact.