
• 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.
Resource Allocation Graph With A Deadlock

*In addition to the request and assignment edges, a claim edge is also introduced.
*Claim edge Pi ® Rj indicated that process Pj may request resource Rj in future; represented by a dashed line.
*Claim edge converts to request edge when a process requests a resource.
*When a resource is released by a process, assignment edge reconverts to a claim edge.
*Resources must be claimed a priori in the system. That is, before a process starts executing, all of its claim edges must already appear in the resource-allocation graph.
*Suppose that process Pi requests resource Rj. The request can be granted only if converting the request edge if converting the request edge Pi®Rj to an assignment edge does not result in a cycle in the resource-allocation graph. That is we use a cycle detection algorithm is used. If no cycle exits, the process Pi will have to wait.
Resource Allocation Graph With A Cycle But No Deadlock

*4 processes "P1, P2, P3, P4"
*P1 and P3 is requesting a process to R1 and R2 respectively.
*P2 and P3 holds an instance of R1
*P1 and P4 holds an instance of R2
*There is no DeadLock
Resource-Allocation Graph For Deadlock Avoidance

The Resource Allocation Graph (RAG) is composed of 2 processes and 2 resources.
· P1 holds an instance of R1
· P2 requests an instance of R1
· P1 and P2 may request an instance of R2
Unsafe State In Resource-Allocation Graph
*the graph shows that R1 is holding the instances of P1, then P1 is requesting for a resource in R2, then R2 is holding the instances of P2 and P2 is requesting instance of R1.
No comments:
Post a Comment