# Explain single and multiple instances resource allocation graph.

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

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.

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

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.

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.