A CHAP6deadlocks
A CHAP6deadlocks
System Model
Deadlock Characterization
Methods for Handling Deadlocks
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
Recovery from Deadlock
Combined Approach to Deadlock Handling
P0 P1
wait (A); wait(B)
wait (B); wait(A)
Process
Pi requests instance of Rj
Pi
Rj
Pi is holding an instance of Rj
Pi
Rj
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.
Sequence <P1, P2, …, Pn> is safe if for each Pi, the resources
that Pi can still request can be satisfied by currently available
resources + resources held by all the Pj, with j<I.
If P resource needs are not immediately available, then P can wait
i i
until all Pj have finished.
When P is finished, P can obtain needed resources, execute,
j i
return allocated resources, and terminate.
When P terminates, P can obtain its needed resources, and so
i i+1
on.
Multiple instances.
Detection algorithm
Recovery scheme
Process control
File management
Device management
Information maintenance
Communications
Responsiveness
Resource Sharing
Economy
Utilization of MP Architectures
Examples
- POSIX Pthreads
- Mach C-threads
- Solaris threads
Examples
- Windows 95/98/NT/2000
- Solaris
- Tru64 UNIX
- BeOS
- Linux
Many-to-One
One-to-One
Many-to-Many
Examples
- Windows 95/98/NT/2000
- OS/2