- 2074 Bhadra · 4 marks
Short note: deadlock and its remedies
Short answer
Remedies are prevention (break one of the four Coffman conditions), avoidance (Banker's algorithm, grant only safe requests), detection and recovery (wait-for graph cycle; terminate or preempt), or ignore the problem as in Windows/UNIX.
Write a short note on Deadlock and its remedies.
Deadlock is a state in which a set of processes are all blocked, each waiting for a resource that is held by another process in the set, so none can continue. It needs four conditions together: mutual exclusion, hold and wait, no preemption and circular wait.
Remedies
- Deadlock prevention: make at least one condition impossible.
- Mutual exclusion: use spooling and make resources shareable where possible.
- Hold and wait: a process must request all its resources at once, or release what it holds before requesting more.
- No preemption: allow the OS to take resources away from a waiting process.
- Circular wait: number the resource types and require requests in increasing order.
- Deadlock avoidance: the OS checks each request and grants it only if the system stays in a safe state (a state where all processes can still finish). The Banker's algorithm is the common method; it needs advance knowledge of maximum needs.
- Deadlock detection and recovery: allow deadlock to happen, detect it with a resource-allocation graph or wait-for graph (a cycle means deadlock for single-instance resources). Recover by terminating one or more processes, or by preempting resources and rolling back a process.
- Ignore the problem (ostrich method): used by Windows and UNIX since deadlocks are rare and prevention is costly.
✓ Answer checked by Claude Opus 5.5 (high effort)