Definition
Deadlock
A deadlock is a situation in concurrent computing where a set of processes are unable to proceed because each is waiting for a resource held by another in the set, forming a circular chain of dependency.
For example, holds Resource A and requests Resource B, while holds Resource B and requests Resource A.
Examples
Roundabout
In a roundabout with “right of way” rules, a deadlock occurs if four cars enter simultaneously. Each occupies a road segment (resource) and waits for the next segment to be vacated. No car can move, creating a circular wait.
Message Passing
performs a blocking
receivefrom , while simultaneously performs a blockingreceivefrom . Both wait for a message (consumable resource) that will never arrive.
Joint Progress Diagram
Definition
Link to originalJoint Progress Diagram
Integrated Strategy
An integrated deadlock strategy combines approaches by grouping resources into classes:
Resource Classes
- Swappable space: Memory blocks on secondary storage
- Process resources: I/O devices and files
- Main memory: RAM assigned to processes
Strategy Mix
Apply the most suitable method per class: preemption for main memory (via swapping), avoidance for process resources, ordering to prevent circular wait.
Conditions for Deadlock
Definition
Link to originalCoffman Conditions
The Coffman conditions are four necessary requirements that must hold simultaneously for a deadlock to occur. Identified by E. G. Coffman, Jr. in 1971.
For a deadlock to exist, all four conditions must be present:
- Mutual Exclusion: At least one resource is non-shareable; only one process may use it at a time.
- Hold and Wait: A process holds at least one resource while waiting to acquire others held by different processes.
- No Preemption: Resources cannot be forcibly removed; they must be released voluntarily.
- Circular Wait: A closed chain exists where each process holds a resource needed by the next in the chain.