🎓 BookMCQ
← Back to 17. Distributed Systems

📝 Recovery from failure in Distributed Systems (8 MCQs)

Restoring Services After Distributed Component Failure

Recovery from failure restores a distributed service or computation after a node, process, network link, or storage component becomes unavailable. Recovery mechanisms may restart processes, restore checkpoints, replay logs, select replicas, or reconstruct lost state. They coordinate across machines because the failure of one component can leave other nodes with incomplete or outdated information.

Why Distributed Recovery Needs Preserved State

After a crash, a process may lose volatile memory while persistent storage survives. Other nodes may not know which messages or operations completed before the failure. Recovery therefore requires checkpoints, durable logs, transaction records, or replicas that preserve enough information to resume work without producing inconsistent results.

Checkpointing, Logging and Restart Procedures

A process periodically saves a checkpoint containing recoverable execution state. On failure, a replacement process or restarted node loads the latest valid checkpoint and replays necessary log records. Distributed applications may also coordinate rollback or transaction recovery to account for messages and operations involving other nodes.

Example of Restarting a Failed Service

A service saves a checkpoint every five minutes and records completed updates in a durable log. It crashes after 12 minutes. On restart, it loads the checkpoint from minute 10 and replays valid log entries recorded afterward, restoring its state without repeating already committed operations.

Recovery Time and Consistency Challenges

Checkpointing and replication reduce the amount of lost work and help restore service. Frequent checkpoints consume storage and processing time, while infrequent checkpoints increase recovery work. Distributed recovery must also handle duplicate messages, partially completed operations, and inconsistent replicas. Recovery protocols need careful ordering and durable records.

Misconceptions About Distributed Recovery

'Restarting a process always restores its previous state' ignores lost volatile memory. 'A checkpoint records every event automatically' depends on its design and consistency guarantees. 'A replica can always replace a failed primary immediately' overlooks lag, election, and consistency requirements.

Exam Focus: Checkpoint and Log Based Recovery

Trace failure detection, restart, checkpoint restoration, and log replay. Calculate the recovery work based on checkpoint intervals and failure time where values are provided. Questions may compare checkpointing with replication or examine duplicate operations, committed transactions, and consistent recovery across multiple nodes.

Key Terms of Distributed Recovery

  • Checkpoint - Saved state for later restoration.
  • Log replay - Reapplying recorded operations after restart.
  • Rollback - Returning to an earlier consistent state.
  • Durable log - Records preserved across crashes.
  • Recovery time - Time needed to restore service.
2
Easy
4
Medium
2
Hard

📝 All Recovery from failure in Distributed Systems MCQs

Q1. A server process crashes and restarts, needing to retransmit lost data. Which layer of the TCP/IP model is primarily responsible for detecting the loss and initiating retransmission?

A.Application layer
B.Transport layer ✅
C.Network layer
D.Data-link layer
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The transport layer, specifically TCP, monitors sequence numbers and acknowledgments to spot missing segments. When a segment is not acknowledged, TCP triggers a timeout and retransmits the data. The application layer does not handle these details, and the network layer only routes packets without checking completeness. Therefore, option B is correct. Options A, C, and D describe layers that either operate above TCP or deal with different responsibilities, so they cannot initiate retransmission. In real systems, the transport layer’s reliability is what restores communication after a crash.

Q2. Which characteristic of the TCP/IP model most directly simplifies recovery from failure compared to the OSI model?

A.More redundancy
B.More standardization
C.Better hardware support
D.Fewer layers ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: The TCP/IP model has fewer layers than the OSI model, which reduces the number of hand‑offs where state must be preserved during a failure. Fewer layers mean fewer protocol interactions to re‑establish, simplifying recovery procedures. Options A, B, and C describe features that may aid recovery but are not the primary reason for the simplification. Thus, option D, “Fewer layers,” correctly identifies the characteristic that most directly eases recovery after a fault.

Q3. In a distributed file system, a client receives a partial file after a network interruption. Which TCP mechanism allows the client to resume the transfer without starting over?

A.TCP sequence numbers ✅
B.UDP checksum
C.IP fragmentation
D.Application-level checkpointing
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: TCP uses sequence numbers and acknowledgment packets to track which bytes have been successfully delivered. When a connection is interrupted, the client can request the missing segment by sending the next expected sequence number, and the server resumes transmission from that point. This prevents the need to restart the whole file transfer. Option A describes this mechanism. Options B and C refer to checksums and fragmentation, which do not enable resumption, and option D describes an application‑level technique that is not inherent to TCP. Hence, TCP’s sequence numbers are the correct answer.

Q4. How does the data-link layer contribute to recovery from failure in a networked system?

A.Provides routing
B.Provides flow control
C.Provides framing and error detection ✅
D.Provides encryption
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The data‑link layer adds framing to delineate packet boundaries and includes error‑detecting codes such as CRC. When a frame is corrupted, the receiver can request retransmission or discard the frame, allowing higher layers to recover from localized errors. Routing and flow control belong to network and transport layers, while encryption is an optional security service. Therefore, option C—providing framing and error detection—is the way the data‑link layer assists recovery. The other options describe functions that are not performed at this layer.

Q5. After a network partition, two replicas have diverged. Which recovery strategy merges their states while preserving causality?

A.Vector clocks with conflict resolution
B.Simple overwrite
C.Two-phase commit ✅
D.Last-write-wins
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Vector clocks record the causal ordering of events across replicas. When a partition heals, each replica can compare its vector clock with the other's to identify concurrent updates and resolve conflicts in a deterministic way, preserving causality. This approach directly merges divergent states while respecting the order of operations. Options B and D simply overwrite data, losing history, and option C (two‑phase commit) is a transaction protocol, not a conflict‑resolution technique. Hence, vector clocks with conflict resolution is the appropriate recovery strategy.

Q6. In which year was the OSI reference model first published?

A.1978 ✅
B.1980
C.1984
D.1990
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The OSI reference model was first introduced in 1978 as a collaborative effort to standardize network communications. This date is a factual piece of information, making it a recall question. The other years listed correspond to later milestones in networking history but do not match the initial publication. Therefore, option A, “1978,” is the correct answer, while options B, C, and D are incorrect because they refer to subsequent, unrelated events.

Q7. A distributed transaction is aborted after one participant crashes. Which protocol ensures the transaction can be either fully committed or fully rolled back once the crashed node recovers?

A.Paxos
B.Three-phase commit
C.Raft
D.Two-phase commit ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: The two‑phase commit protocol guarantees atomicity by coordinating a prepare phase and a commit phase among all participants. If a participant crashes after the prepare phase, the coordinator records the decision and, once the crashed node recovers, the protocol ensures either all participants commit or all abort, preserving consistency. Paxos and Raft are consensus algorithms for leader election, not transaction atomicity, and three‑phase commit adds an extra phase but is rarely used due to complexity. Thus, option D, two‑phase commit, is correct.

Q8. When comparing error control, which layer provides end‑to‑end reliability across multiple network hops?

A.Neither
B.Both equally
C.Transport layer ✅
D.Data-link layer
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: End‑to‑end reliability means that a message is guaranteed to reach its destination correctly across multiple network segments. This guarantee is provided by the transport layer, such as TCP, which implements retransmission, sequencing, and flow control across the entire path. The data‑link layer can only assure reliability on a single hop, and neither layer alone can provide it across the whole network. Therefore, option C, “Transport layer,” correctly identifies the layer that offers end‑to‑end reliability.

🔗 Related Topics (MCQs)