🎓 BookMCQ
← Back to 7. Deadlocks

📝 Recovery from Deadlock in Operating System (41 MCQs)

📖 From Operating System • 7. Deadlocks • 41 questions available

What is Recovery from Deadlock in Operating System?

Definition:
Recovery mechanisms restore normal system operation after deadlock detection by either terminating processes or preempting resources.

Example:
Upon detecting deadlock set D={P2,P5,P7}D = \{P_2, P_5, P_7\}, the OS selects victim PvDP_v \in D for termination or resource stripping.

Reason:
Without recovery, detected deadlocks persist indefinitely; recovery policies determine the fairness, efficiency, and data integrity consequences of resolution.

6
Easy
21
Medium
14
Hard

📝 All Recovery from Deadlock in Operating System MCQs

Q1. What triggers the recovery process from a deadlock?

A.A periodic timer.
B.The detection algorithm determining that a deadlock exists. ✅
C.A user complaint.
D.High CPU utilization.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Recovery is a reactive measure. It is initiated only after the deadlock detection algorithm has examined the system state and confirmed that a deadlock currently exists.

Q2. Which of the following is NOT a general approach to handling a detected deadlock?

A.Informing the operator for manual resolution.
B.Letting the system recover automatically.
C.Preventing the deadlock from ever occurring. ✅
D.Aborting processes or preempting resources.
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Prevention is a proactive strategy used before deadlocks occur. Once a deadlock is detected, the options are manual intervention, automatic recovery via abortion, or automatic recovery via preemption.

Q3. In the manual recovery approach, who is responsible for breaking the deadlock?

A.The operating system kernel.
B.The system operator. ✅
C.The deadlocked processes.
D.The hardware.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Manual recovery involves informing the human operator that a deadlock has occurred. The operator then analyzes the situation and takes appropriate actions (e.g., killing processes) to resolve it.

Q4. What is a potential disadvantage of manual recovery?

A.It is too fast.
B.It requires human intervention, which may be slow or unavailable. ✅
C.It causes data loss.
D.It is fully automated.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Relying on an operator means the system may remain deadlocked for a significant time while waiting for human response. This delays resolution and keeps resources idle longer than an automatic system might.

Q5. What are the two primary automatic options for breaking a deadlock?

A.Increasing memory and CPU speed.
B.Aborting processes and preempting resources. ✅
C.Restarting the computer and deleting files.
D.Ignoring the deadlock and waiting.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The text explicitly identifies two automatic methods: aborting one or more processes to break the circular wait, and preempting resources from deadlocked processes.

Q6. How does aborting processes break a deadlock?

A.It releases all resources held by the terminated processes. ✅
B.It increases the number of resources.
C.It speeds up the remaining processes.
D.It prevents future requests.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When a process is aborted, the operating system reclaims all resources allocated to it. These freed resources can then be allocated to other waiting processes, breaking the circular wait condition.

Q7. What is resource preemption in the context of deadlock recovery?

A.Giving more resources to a process.
B.Forcibly taking resources away from a deadlocked process. ✅
C.Asking a process to voluntarily release resources.
D.Adding new hardware resources.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Preemption involves the system forcibly seizing resources from one or more deadlocked processes and giving them to other processes in the cycle to allow them to proceed, thus breaking the deadlock.

Q8. Why might a system choose automatic recovery over manual recovery?

A.To increase human workload.
B.To ensure faster resolution and continuous operation without human aid. ✅
C.Because manual recovery is impossible.
D.Because automatic recovery is always safer.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Automatic recovery allows the system to resolve deadlocks immediately without waiting for an operator. This minimizes downtime and resource idleness, which is crucial for unattended or real-time systems.

Q9. If a process is aborted, what happens to its computation progress?

A.It is saved automatically.
B.It is lost unless checkpointed. ✅
C.It continues in the background.
D.It is transferred to another process.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Aborting a process terminates it immediately. Any work done since the last save point (checkpoint) is lost. This is a significant cost associated with process abortion.

Q10. What is a major challenge associated with resource preemption?

A.It is too easy to implement.
B.It may require rolling back the preempted process to a safe state. ✅
C.It increases resource availability.
D.It prevents deadlocks entirely.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: If a resource is taken from a process mid-operation, that process may be left in an inconsistent state. The system must be able to roll back the process to a previous safe state where it didn't hold the preempted resource, which is complex.

Q11. Which recovery method involves selecting a 'victim' process?

A.Manual recovery.
B.Process abortion.
C.Resource preemption.
D.Both abortion and preemption. ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Both methods require selecting victims. In abortion, you select which process(es) to kill. In preemption, you select which process(es) to take resources from. Selection criteria often involve cost factors like priority or execution time.

Q12. Is it always necessary to abort ALL processes in a deadlock cycle?

A.Yes, always.
B.No, aborting one or more may be sufficient. ✅
C.No, none need to be aborted.
D.Yes, if there are more than 3 processes.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Breaking the circular wait only requires removing one link in the chain. Aborting just one process in the cycle releases its resources, allowing others to proceed. Aborting all is unnecessary and more costly.

Q13. What is the risk of starving a process during recovery?

A.It runs too fast.
B.It is repeatedly selected as a victim and never completes. ✅
C.It gets too many resources.
D.It causes a deadlock.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: If the same process is consistently chosen as the victim for abortion or preemption due to low priority or other criteria, it may never make progress. This is known as starvation.

Q14. Why is manual recovery rarely used in modern high-availability systems?

A.Operators are not available.
B.It is too slow and error-prone for critical systems. ✅
C.It is illegal.
D.It requires special software.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: High-availability systems require minimal downtime. Manual intervention introduces unpredictable delays and potential for human error, making automatic recovery mechanisms preferable.

Q15. What determines which process to abort in an automatic scheme?

A.Random selection.
B.Cost factors such as process priority, execution time, and resources held. ✅
C.The process name.
D.The user's preference.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Systems use cost functions to minimize disruption. Factors include process priority (kill low priority first), how long it has run (kill newer ones to save work), and how many resources it holds (kill those holding fewest to free least).

Q16. Can resource preemption cause a process to fail?

A.No, it is safe.
B.Yes, if the process cannot handle the sudden loss of a resource. ✅
C.Only if the process is old.
D.Only if the resource is memory.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Some applications are not designed to handle having resources taken away unexpectedly. Preempting a critical resource (like a locked database record) without proper rollback mechanisms can cause the process to crash or produce incorrect results.

Q17. What is the primary goal of any deadlock recovery method?

A.To punish the offending process.
B.To break the circular wait and allow the system to proceed. ✅
C.To increase the number of processes.
D.To reduce memory usage.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The fundamental objective is to resolve the deadlock condition (circular wait) so that the involved processes (or at least the remaining ones) can continue execution and the system can return to normal operation.

Q18. If a system uses process abortion, what must happen to the resources held by the aborted process?

A.They remain allocated.
B.They are released back to the available pool. ✅
C.They are deleted.
D.They are given to the operator.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Upon termination, the operating system reclaims all resources owned by the process. These resources become available again for allocation to other processes, helping to resolve the deadlock.

Q19. Which method is generally considered more complex to implement correctly?

A.Informing the operator.
B.Process abortion.
C.Resource preemption. ✅
D.Detecting the deadlock.
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Preemption requires sophisticated mechanisms to safely take resources, roll back processes to consistent states, and potentially restart them. Abortion is simpler: just terminate and clean up. Manual is simplest but slowest.

Q20. What is a 'rollback' in the context of resource preemption?

A.Moving a process to a different CPU.
B.Restoring a process to a previous safe state before the preempted resource was acquired. ✅
C.Deleting the process.
D.Increasing the process priority.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When a resource is preempted, the process holding it may be in an invalid state. Rollback involves reverting the process to a checkpoint or safe state where it did not hold the preempted resource, allowing it to retry later.

Q21. Why might aborting a process be preferred over preemption?

A.It is less disruptive to the process logic.
B.It avoids the complexity of rollback and state consistency. ✅
C.It saves more work.
D.It is slower.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Abortion simply ends the process. There is no need to worry about restoring a consistent state for that specific process because it is gone. Preemption requires careful state management to avoid corruption.

Q22. If a deadlock involves 5 processes, what is the minimum number of processes that must be aborted to guarantee breaking the deadlock?

A.1 ✅
B.2
C.3
D.5
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Aborting just one process breaks the cycle. The resources it held are released, allowing the next process in the chain to proceed, which then releases its resources, and so on.

Q23. What is the impact of frequent process abortions on system throughput?

A.It increases throughput.
B.It decreases throughput due to wasted computation. ✅
C.It has no effect.
D.It stabilizes throughput.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Each aborted process represents wasted CPU time and resources. Frequent abortions mean the system is spending significant effort on work that is never completed, reducing overall effective throughput.

Q24. Can a system combine both abortion and preemption?

A.No, it must choose one.
B.Yes, a hybrid approach is possible. ✅
C.No, they are incompatible.
D.Only in manual mode.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: A sophisticated recovery system might try preemption first for critical processes and resort to abortion if preemption fails or is too costly. Or it might abort low-priority processes and preempt from high-priority ones.

Q25. What information is needed to select a victim for abortion?

A.Process ID only.
B.Cost factors like priority, age, and resource usage. ✅
C.User password.
D.Network address.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: To make an intelligent decision, the system needs data about each process: its priority (don't kill critical services), how long it has run (don't kill nearly-finished tasks), and resources held.

Q26. Why is starvation a concern in deadlock recovery?

A.Processes run too fast.
B.Some processes may never complete if always chosen as victims. ✅
C.Resources are too abundant.
D.Deadlocks never occur.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: If the victim selection algorithm consistently picks the same process (e.g., the lowest priority one), that process may be repeatedly aborted or preempted, preventing it from ever finishing its task.

Q27. What is the role of the operator in manual recovery?

A.To write code.
B.To analyze the deadlock and take corrective action. ✅
C.To ignore the problem.
D.To restart the hardware.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The operator receives the alert, examines which processes are deadlocked, and decides which to kill or how to intervene to break the cycle.

Q28. Which recovery method is most suitable for batch processing systems?

A.Manual recovery.
B.Process abortion. ✅
C.Resource preemption.
D.Waiting indefinitely.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: In batch systems, jobs can often be restarted easily. Aborting a job and resubmitting it is often simpler and safer than trying to preempt resources and roll back complex state in an interactive environment.

Q29. Which recovery method is most suitable for interactive/real-time systems?

A.Process abortion.
B.Resource preemption (with rollback). ✅
C.Manual recovery.
D.Terminating the OS.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Interactive users expect continuity. Aborting their process is frustrating. Preemption with rollback allows the system to resolve the deadlock while potentially preserving the user's session state, though it is complex.

Q30. What happens if no victim can be safely aborted or preempted?

A.The system continues normally.
B.The system may need to be restarted manually. ✅
C.The deadlock resolves itself.
D.More resources are added.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: In extreme cases, if all processes are critical and cannot be rolled back or lost, automatic recovery may fail. This might necessitate a full system restart or heavy manual intervention.

Q31. Does deadlock recovery guarantee that deadlocks will not happen again?

A.Yes, forever.
B.No, it only resolves the current instance. ✅
C.Yes, if abortion is used.
D.Yes, if preemption is used.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Recovery fixes the *current* deadlock. It does not change the underlying resource allocation patterns that caused it. Unless prevention/avoidance is also used, deadlocks can recur.

Q32. What is the 'cost' of a victim process?

A.Its monetary value.
B.A metric combining priority, execution time, and resources to determine impact. ✅
C.Its memory size.
D.Its network usage.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The cost function estimates the disruption caused by selecting a process as a victim. Lower cost means less impact (e.g., low priority, short run time), making it a better candidate for abortion/preemption.

Q33. Why is preempting resources from a process difficult?

A.The process may resist.
B.The system must ensure data consistency and provide rollback mechanisms. ✅
C.Resources are locked physically.
D.It requires user permission.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Simply taking a resource isn't enough. The process using it might have modified shared data. The system must ensure that taking the resource doesn't corrupt the system state, often requiring complex rollback protocols.

Q34. If a process is aborted, do its child processes survive?

A.Always.
B.Usually, they are also terminated. ✅
C.They become independent.
D.They are paused.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: In most operating systems, terminating a parent process results in the termination of its child processes (orphaned processes are adopted by init, but often killed if they depend on the parent). This amplifies the cost of abortion.

Q35. What is the primary advantage of resource preemption over abortion?

A.It is simpler.
B.It allows the process to continue eventually without total loss of progress. ✅
C.It is faster.
D.It requires no overhead.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Preemption aims to save the process. By rolling back and retrying, the process can eventually complete its task. Abortion discards all progress, requiring a full restart.

Q36. Can deadlock recovery be fully transparent to the user?

A.Yes, with effective preemption and rollback. ✅
B.No, the user always sees an error.
C.Yes, with abortion.
D.No, the system crashes.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: If preemption and rollback are handled smoothly, the user might experience a slight delay but no loss of work or visible error. Abortion usually results in visible failure (program crash).

Q37. What is the relationship between detection and recovery?

A.They are independent.
B.Detection identifies the problem; resolution solves it. ✅
C.Detection solves the problem.
D.Recovery identifies the problem.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Detection is the diagnostic phase (finding the deadlock). Recovery is the therapeutic phase (fixing the deadlock). They are sequential steps in handling deadlocks.

Q38. Why is 'doing nothing' (Ostrich Algorithm) sometimes considered a form of recovery?

A.It isn't.
B.It relies on the user to reboot or kill processes manually. ✅
C.It fixes the deadlock.
D.It prevents deadlocks.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: In some systems (like personal PCs), the OS ignores deadlocks. The 'recovery' is left entirely to the user (manual recovery) who notices the freeze and reboots or kills tasks. It's a passive form of manual recovery.

Q39. What is the main trade-off in choosing a victim?

A.Speed vs. Accuracy.
B.Minimizing cost vs. Avoiding starvation. ✅
C.Memory vs. CPU.
D.Priority vs. Name.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: You want to pick the lowest-cost victim to minimize disruption. However, if you always pick the same low-cost one, it starves. You must balance efficiency with fairness.

Q40. If a system recovers from deadlock by aborting processes, what is the likely user experience?

A.Seamless continuation.
B.Loss of unsaved work and application termination. ✅
C.Faster performance.
D.No change.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Abortion kills the application. Users lose any unsaved data in that application and must restart it. This is disruptive and frustrating.

Q41. What is the significance of 'breaking the circular wait'?

A.It is the only way to resolve the deadlock.
B.It allows processes to proceed. ✅
C.It prevents future deadlocks.
D.It increases resource count.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Deadlock is defined by circular wait. Breaking this circle (by releasing resources via abortion or preemption) removes the necessary condition for deadlock, allowing the blocked processes to move forward.

🔗 Related Topics (MCQs)