Skip to main content

Threads, checkpoint, distributed commit

Short answer

Threads share process memory and are lightweight, while processes have isolated address spaces. A checkpoint saves process state to stable storage, enabling rollback recovery from the latest consistent global state without domino effect. Distributed commit ensures all participants either all commit or all abort an operation, typically using two-phase commit.

How do threads differ from process? How does checkpoint help in recovery? What does distributed commit refer to?

Threads versus process

A process has its own protected address space and resources, whereas threads are lightweight units of execution inside a process that share its address space, data and open files, but have their own stack, registers and program counter.

PointProcessThread
Address spaceSeparateShared
Creation and switchingCostlyCheap
CommunicationIPC neededShared memory
IsolationStrongNone

Checkpoint in recovery

A checkpoint is a saved snapshot of the state of a process (or of the whole distributed application) on stable storage, taken periodically. If a failure occurs, the process is restarted from the latest checkpoint (rollback recovery) rather than from the beginning, so only the work since the checkpoint is lost. In a distributed system the checkpoints of processes must form a consistent global state (a recovery line, with no message received but not sent). Otherwise a rollback of one process forces others to roll back too (domino effect). Coordinated checkpointing or message logging avoids this.

Distributed commit

Distributed commit is the problem of making all the processes taking part in a distributed transaction or operation either all commit (make the changes permanent) or all abort, so that atomicity is kept. The usual solution is the two-phase commit (2PC) protocol: in phase 1 the coordinator asks all participants to vote (prepare); if all vote yes, in phase 2 the coordinator tells all to commit, otherwise to abort. Three-phase commit reduces blocking.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 3 questions →