Question #130: Consider the following resource allocation graphs. Here resources have multiple instances indicated by the circles (R2 has 2 instances, R3 has 1 instance).
Figure 1:
Figure 2:
Which of the following statements is true about the figures above?
Options:
- Both depict a deadlock.
- Only figure 1 has a deadlock, figure 2 doesn’t.
- Only figure 2 has a deadlock, figure 1 doesn’t.
- Can’t say.
Solution: 2nd option is the correct one. In figure 1, P1 is waiting for P2, P2 is waiting for P3, P3 is waiting on both P1 & P2 (as can be seen by the cycle). In figure 2, P2 is not waiting for any other process & thus will release R1 eventually, which will break the cycle in the graph and thus it is not deadlocked. This is an example of resource allocation graph with cycle but no deadlock.

