Two conditions must hold for a deadlock to occur with reusable resources:
- Hold and wait: A process is already holding one resource and is requesting another resource.
- Circular wait: A process must issue a resource request that closes a cycle involving at least two processes and two resources.
Deadlock is structurally impossible if either of the two conditions are eliminated.
Eliminating Hold and Wait
Several alternatives to eliminating the hold-and-wait condition exist:
- Every process must request all resources ever needed at the same time. While simple, this leads to poor resource utilization since resources are held for unnecessarily long periods of time and thus unavailable to other processes.
- Every process must release all currently held resources prior to making any new request. Improves utilization but results in repeated requests and releases of frequently used resources.
- A process can be given the ability to test whether a needed resource is currently available. The process must release all currently held resources only if the requested resource is not currently available. Otherwise the new resource may be requested and allocated immediately.
Static Deadlock Prevention was originally found on Access 2 Learn