Necessary Conditions
Figure 3:
An example to Deadlock.
|
- A deadlock situation can arise if the following four conditions hold simultaneously in a system:
- Mutual exclusion. At least one resource must be held in a nonsharable mode;
- That is, only one process at a time can use the resource.
- If another process requests that resource, the requesting process must be delayed until the resource has been released.
- Hold and wait. A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other processes.
- No preemption. Resources cannot be preempted; that is, a resource can be released only voluntarily by the process holding it, after that process has completed its task.
- Circular wait. A set
of waiting processes must exist such that
- is waiting for a resource held by ,
- is waiting for a resource held by ,
-
- is waiting for a resource held by ,
- is waiting for a resource held by .
There must be a circular chain of two or more processes, each of which is waiting for a resource held by the next member of the chain.
- We emphasise that all four conditions must hold for a deadlock to occur.
Cem Ozdogan
2010-04-19