What is aDeadlock?
• • A deadlock is a situation where a set of
processes are blocked.
• • Each process is waiting for a resource held
by another process.
• • No process can proceed.
3.
Necessary Conditions (Coffman
Conditions)
•The following four conditions must hold
simultaneously:
• • Mutual Exclusion
• • Hold and Wait
• • No Preemption
• • Circular Wait
4.
Resource Allocation Graph
•• Used to represent resources and processes.
• • A cycle in the graph indicates a possible
deadlock.
• • For one resource per type, cycle = deadlock.
Deadlock Prevention
• •Ensures at least one Coffman condition does
not occur.
• • Break one of the conditions:
• - Mutual Exclusion
• - Hold and Wait
• - No Preemption
• - Circular Wait
Real-Life Examples
• •Two trains waiting on a single-track section.
• • Two people trying to pass in a narrow
hallway.
• • Printers and scanners shared in network.