Lecture3 ch07
Lecture3 ch07
Chapter 7: Deadlocks
1
The Deadlock Problem
P0 P1
wait (A); wait(B)
wait (B); wait(A)
2
System Model
Deadlock Characterization
3
Resource-Allocation Graph
Process
Pi requests instance of Rj
Pi
Rj
Pi is holding an instance of Rj
Pi
Rj
4
Example of a Resource Allocation Graph
5
Resource Allocation Graph With A Cycle But No Deadlock
Basic Facts
6
Methods for Handling Deadlocks
Deadlock Prevention
7
Deadlock Prevention (Cont.)
No Preemption –
If a process that is holding some resources requests
another resource that cannot be immediately allocated to
it, then all resources currently being held are released.
Preempted resources are added to the list of resources
for which the process is waiting.
Process will be restarted only when it can regain its old
resources, as well as the new ones that it is requesting.
Deadlock Avoidance
8
Deadlock Detection
Detection algorithm
Recovery scheme
9
Recovery from Deadlock: Resource Preemption
Rollback – return to some safe state, restart process for that state.
End of Chapter 7
10