Resource Allocation Graph
Process
Resource
Assigned
Request (wait)
Detection Result
Configure edges and click Detect Deadlock to run cycle detection on the wait-for graph.
How It Works
Resource Allocation Graph (RAG)
A directed graph where:
- Circles = processes (P0, P1, ...)
- Squares = resources (R0, R1, ...)
- Green arrow R → P = resource assigned to process
- Red arrow P → R = process is waiting for resource
Deadlock exists if and only if there is a cycle in the wait-for graph. We detect this using DFS with coloring (white/gray/black). A back edge (to a gray node) indicates a cycle.
Conditions for deadlock:
1. Mutual exclusion
2. Hold and wait
3. No preemption
4. Circular wait (the cycle)
A directed graph where:
- Circles = processes (P0, P1, ...)
- Squares = resources (R0, R1, ...)
- Green arrow R → P = resource assigned to process
- Red arrow P → R = process is waiting for resource
Deadlock exists if and only if there is a cycle in the wait-for graph. We detect this using DFS with coloring (white/gray/black). A back edge (to a gray node) indicates a cycle.
Conditions for deadlock:
1. Mutual exclusion
2. Hold and wait
3. No preemption
4. Circular wait (the cycle)