2. What is Deadlock?
• A dead-lock is a situation in which two devices or computer programs
sharing the same resource are affectively stopping each other from
accessing the resource.
• Final result in both programs closing to function.
3. Four conditions for Deadlocks?
1. Mutual Exclusion condition
2. Hold & wait condition
3. No preemption condition
4. Circular wait condition
6. How to Handle deadlocks?
• Four major areas of interest in deadlock research
1) Deadlock prevention
2) Deadlock Avoidance
3) Deadlock detection
4) Deadlock Recovery
7. Deadlock prevention?
• Prevention eliminates one of four conditions
1. Elimination of Mutual Exclusion
2. Elimination of Hold & wait condition
3. Elimination of No preemption condition
4. Elimination Of Circular Wait Condition
8. How deadlock can be avoided?
• We can avoid the situation of
deadlocked by:
1. Safe state
2. Banker’s Algorithm
3. Resource Allocation Graph
9. Safe state
• State is safe because OS can definitely avoid deadlock by
blocking any new requests until safe order is executed.
This avoids circular wait condition.
Process waits until safe state is guaranteed.
11. Resource Allocation Graph
• If we have a resource allocation system with only one instance of each
process, a variant of the resource allocation graph can be used for
deadlock avoidance.