- Year not given
Deadlock conditions; recovery methods
Short answer
Deadlock occurs when each process in a set waits for a resource held by another in the set. The four conditions are mutual exclusion, hold and wait, no preemption, and circular wait. Recovery methods include resource preemption (taking resources from a process), rollback to checkpoints (restarting a process from a saved state), and killing deadlocked processes (terminating one or all processes in the cycle).
Define deadlock. What are the conditions for resource deadlock? Explain some methods for recovery from deadlock.
Deadlock
A set of processes is deadlocked if each process is waiting for an event (release of a resource) that can be caused only by another process in the set.
Conditions for resource deadlock (Coffman)
- Mutual exclusion: each resource is either assigned to exactly one process or is available.
- Hold and wait: processes holding earlier-granted resources may request new ones.
- No preemption: resources previously granted cannot be forcibly taken away.
- Circular wait: a circular chain of two or more processes exists, each waiting for a resource held by the next one.
Recovery from deadlock
- Recovery through preemption: temporarily take a resource away from its owner and give it to another process. This often needs manual intervention and depends on the resource (e.g. suspending a process and giving its printer to another is difficult, but taking memory by swapping is possible).
- Recovery through rollback: processes are checkpointed regularly (state and resources saved in files). On deadlock, a process that owns a needed resource is rolled back to a checkpoint before it acquired it, and the resource is given to a waiting process.
- Recovery through killing processes: the simplest. Kill one process in the cycle, or all of them. The victim should be one that can be rerun without bad effects (e.g. a compile, not a database update). The process is chosen using priority, run time, and resources held.
After recovery, care is needed to avoid starvation, so the same victim is not chosen repeatedly.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Four deadlock conditions; prevention, recovery · Operating System, chapter 7
- Deadlock conditions; Banker's with 4 processes · Operating System, chapter 7
- Deadlock; necessary conditions with examples · Operating System, chapter 7
- Deadlock conditions and why all necessary · Operating System, chapter 7
- Deadlock conditions, detection, action · Operating System, chapter 7
- Deadlock conditions; Banker's safe sequence · Operating System, chapter 7
- Distributed deadlock and recovery · Distributed System, chapter 8 · asked 3×
- Deadlock and Coffman conditions · Embedded System, chapter 6 · asked 4×
- Deadlock and its conditions · Microprocessor, chapter 6 · asked 2×