SF
STUDY FRIENDTRB Computer Science · Revision Note
1UNIT 4 · OPERATING SYSTEMS
Deadlock: Detection & Recovery
Quick revision guide for TRB Computer Instructor
Core idea
A deadlock is a state in which every process in a set waits for an event that only another process in the set can cause.
1. Detection approach
The system permits deadlocks, then periodically runs a detection algorithm using allocation and request matrices.
- Single instance: wait-for graph
- Multiple instances: matrix-based detection
- Detection frequency depends on system cost
2. Recovery methods
After detection, the operating system may terminate processes or preempt resources.
- Process termination
Abort all or one process at a time. - Resource preemption
Choose a victim, roll back and prevent starvation.
TRB exam tipVictim selection considers priority, work completed and resources held.