Resource allocation graphs are drawn in order to see the allocation relations of processes and resources easily. In these graphs, processes are represented by circles and resources are represented by boxes. Resource boxes have some number of dots inside indicating available number of that resource, that is number of instances.

resource-allocation-graphs

  • If the resource allocation graph contains no cycles then there is no deadlock in the system at that instance.
  • If the resource allocation graph contains a cycle then a deadlock may exist.
  • If there is a cycle, and the cycle involves only resources which have a single instance, then a deadlock has occurred.

Example
example-5-2

There are three cycles, so a deadlock may exists. Actually p1, p2 and p3 are deadlocked

Example
example-5-3

There is a cycle, however there is no deadlock. If p4 releases r2, r2 may be allocated to p3, which breaks the cycle.

Share with : Share on Linkedin Share on Twitter Share on WhatsApp Share on Facebook