Deadlock
Deadlock
1) Requests a resource
Deadlock
A set of two or more processes are deadlocked if they are blocked (i.e., in the waiting
state) each holding a resource and waiting to acquire a resource held by another process
in the set.
or
Example:
two processes are deadlocked if each holds one tape drive and has requested the
other
All of the following four necessary conditions must hold simultaneously for deadlock to
occur:
Circular wait implies the hold and wait condition. Therefore, these conditions are not
completely independent.
Summary
definition of deadlock
three methods of addressing deadlock
o ensure deadlock never arises
deadlock prevention: ensure at least one of the four necessary
conditions for deadlock never holds
mutual exclusion
hold and wait
no preemption
circular wait
deadlock avoidance
less stringent, but requires a priori information
Banker's algorithm
o deadlock detection and recovery
terminate processes: selecting a victim
preempt resources
selecting a victim
rollback
starvation
o ignore the problem (most common approach)