Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests - Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests -

Resource Allocation Graph in Operating System

We use the resource-allocation graph for the pictographic depiction of a system’s state. It contains all of the details about the processes that are holding and waiting for resources. The data about available resources, as well as the resources that the process is consuming, is contained in the resource allocation graph, which includes all information linked to all instances of resources.

In this article, we will look more into the Resource Allocation Graph in Operating Systems according to the GATE Syllabus for (Computer Science Engineering) CSE. Read ahead to find out more about it.

Table of Contents

What is the Resource Allocation Graph?

The resource allocation graph is a visual depiction of a system’s current status. The resource allocation graph, as its name implies, contains all the information about all of the activities that are holding or waiting for resources.

It also provides information on all instances of all resources, whether available or in use by processes. The process is represented by a circle in the Resource Allocation Graph, whereas the resource is represented using a rectangle. Let’s take a closer look at the various types of vertices and edges.

Resource-Allocation-Graph-in-Operating-System

There are two sorts of vertices: resource and process. A distinct form will be used to symbolise each of them. The circle denotes the process, whereas the rectangle denotes the resource.

There can be several instances of a resource.

Resource-Allocation-Graph-in-Operating-System

In RAG, there are two sorts of edges: One represents assignment, and the other represents a process waiting for a resource. Each of them is depicted in the image above.

In case the tail of the arrow is connected to a resource instance and the head is connected to a process, the resource is shown to be assigned to that process. If the tail of the arrow is connected to the process and the head is pointed towards the resource, the process is represented as waiting for a resource.

Resource-Allocation-Graph-in-Operating-System

Example

Consider three processes, P1, P2, and P3, as well as two resource types, R1 and R2. Each resource has a single instance. According to the graph, P1 is using R1, P2 is holding R2 while waiting for R1, and P3 is waiting for both R1 and R2.

Because no cycle is generated in the graph, there is no deadlock.

Resource-Allocation-Graph-in-Operating-System

Components of Resource Allocation Graph (RAG)

Vertices

We employ two types of vertices in the resource allocation graph:

Process Vertices: Process vertices are used to depict a process. We use a circle to represent the process vertices and write the process name inside the circle.

Resource Vertices: Resource vertices are used to represent a resource. We use a rectangle to represent the resource vertices and use dots inside the circle to indicate the number of instances in that resource.

Resource-Allocation-Graph-in-Operating-System

There are two sorts of resource vertices, single instances and multiple instances, based on the number of instances that might exist in the system.

Multiple instance resource type: We use numerous dots inside the box in the multiple instance resource type. Multiple dots indicate that the resource is used multiple times.

Single instance resource type: We use a single dot inside the box in the single instance resource type. The solitary dot signifies that the resource is used only once.

Edges

Resource-Allocation-Graph-in-Operating-System

In the resource allocation graph, we use two types of edges:

Request Edges: The request edge is used to represent the process’s waiting state. An arrow can be used to draw an arrow edge, just as it is in the assigned edge. The arrowhead points to a resource instance, while the process tail points to the process. If a process requires ‘n’ instances of a resource type, for example, we will draw ‘n’ assign edges.

Assign Edges: An assign edge is used to indicate the process’s resource allocation. We use an arrow to draw assigned edges, with the arrowhead pointing to the process and the process tail pointing to the resource instance.

Keep learning and stay tuned to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2023, GATE Admit Card, GATE Syllabus, GATE Previous Year Question Paper, and more.

 

Also Explore,