Recall (System) Resource Allocation Graphs (SRAGs).
They can be used to demonstrate deadlock.
Now consider some larger SRAGs:
This SRAG shows processes P0,
P1, P3,
P4, and P5,
with (single-instance) resources R0,
R1, R3,
R4, R5,
and R6.
A request edge, Pi --> Rj,
means that the process Pi needs the
resource Rj.
An allocation edge, Rj -->
Pi,
means that the process Pi has been
allocated the resource Rj.
A cycle in a Resource Allocation Graph suggests that
there might be circular wait in the system, i.e.
deadlock.
However, this may happen without deadlock
being present.
Examine the SRAG above.
- Is there a cycle?
- Is the system in a safe state?
- Is the system deadlocked?
This SRAG shows processes P1,
P3, P4,
P5, and P6,
with (single-instance) resources R1
and R4, along with
with (double-instance) resources R0,
R5, P6,
and R7.
In other words, there are two each of resources
R0, R5,
P6, and R7.
Examine this SRAG.
- Is there a cycle?
- Is the system in a safe state?
- Is the system deadlocked?
Resources for SRAGs can have any number of instances.
Here's one more example of a SRAG with multiple resource
instances.
Again, examine this SRAG.
- Is there a cycle?
- Is the system in a safe state?
- Is the system deadlocked?