Explain single and multiple instances resource allocation graph.

This answer is restricted. Please login to view the answer of this question.

Login Now
  1. Single Instance – It contains the single instance of the resource, and is represented by a single dot inside the rectangle which is the resource vertex.

Example of Single Instances RAG

- Hamro CSIT

In the above single instances RAG example, it can be seen that P2 is holding the R1 and waiting for R3P1 is waiting for R1 and holding R2 and, P3 is holding the R3 and waiting for R2. So, it can be concluded that none of the processes will get executed.

It can also be concluded by writing it in the form of an allocation and request matrix.

Process      Allocation      Request
    Resource    Resource
R1 R2 R3 R1 R2 R3
P1  0  1  0  1  0  0
P2  1  0  0  0  0  1
P3  0  0  1  0  1  0

Here, from the matrix above, the available instance of R1 is 0, R2 is 0 and R3 is 0, and each of the processes is waiting for any one resource. So, none of the processes will get executed and there will be a deadlock.

Note: If there is a cycle in a single instance RAG then the processes will be in a deadlock.

2. Multiple Instance – It contains the multiple instances of the resource, and is represented by multiple (more than one) dots inside the rectangle.

Example of Multiple Instances RAG

- Hamro CSIT

In the case of Multiple Instances RAG, it becomes difficult to analyze from the RAG that the system is in a safe state or not.

To determine the state of the system we will write it in the form of an allocation and request matrix.

Process      Allocation      Request
    Resource    Resource
R1 R2 R3 R1 R2 R3
P1  0  1  0  1  0  0
P2  1  0  0  0  0  1
P3  0  0  1  0  1  0
P4  0  0  1  0  0  0

The above matrix is filled from the given Multiple Instance RAG.

As R2 is allocated to P1, write 1 in the Allocation Matrix corresponding to P1 and R1 and others 0 and similarly for all others. P1 is waiting for R1 so, write 1 in the Request Matrix corresponding to P1 and R1 and others 0 and similarly for all others.

If you found any type of error on the answer then please mention on the comment or report an answer or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Discussion
0 Comments
  Loading . . .