Last modified on March 2nd, 2020
Resource Allocation Graph – Resource Instance Management and Advantages
As we see in Banker’s algorithm that this algorithm helps in safe allocation of resources. Similarly, if we want to represents the state of the system in the form of a graph instead of using the banker’s algorithm’s table, then Resource Allocation Graph can be helpful. It is very easy to understand and represents resource allocation with the help of a graph. This kind of graph shows the allocation of resources, is called Resource Allocation Graph (RAG).
Advantages of Resource Allocation Graph
- It takes less time to understand the resource allocation via the Resource Allocation Graph.
- Sometimes it is possible to see a deadlock directly with a glance by using Resource Allocation Graph, which is very difficult to understand by looking at the table.
- Resource Allocation Graph helps us to understand the following main things;
- Which resource is required by the process.
- How many resources are required by the process?
- How many resources are available
- How many are allocated?
Disadvantages of Resource Allocation Graph
It is better to store the resources allocation record in tables if the system contains many processes and resources and Resource Allocation Graphs are better when the system contains fewer processes and resources.
How many types of Resource Allocation Graph edge exists?
There are two main types of edges in the Resource Allocation Graph.
Request Edge represents that a process is trying to request to get some resources.
Assign Edge represents that a resource is allocated to the process and the process is enjoying the resource.
In figure 2, we can observe the following facts;
- Process P1 is requesting for Resource R1 and R2 and P1 have no resource.
- Process P2 is requesting Resource R3 and P2 is enjoying the resource R1(assigned).
- Process P3 is requesting Resource R4 and P3 is enjoying the resource R2(assigned).
- Process P4 is requesting for Resource R3 and R4, and P4 have no resource.
Parts of Resource Allocation Graph
Resource Allocation Graph contains vertices and edges. In Resource Allocation Graph vertices are of two types.
How many types of Resource Allocation Graph vertices?
There are two main types of resource allocation graph vertices.
- Process Vertex
- Resource Vertex
In Process vertex, the process can be represented with a circle. Every process will be represented as a process vertex.
In Resource vertex, Every resource can be represented as a resource vertex.
Resource vertex is of two types;
- Single instance type of resource
- Multi-resource instance type resource
Single resource instance
It represents a box and there will be one dot inbox to represent the one resource instance. So, we can say that the number of dots indicates how many resource instances are present of each resource type.
It also represents as a box, inside the box, there can be many dots and each of the dots represents the resource instance type.