Multi-Instance Resource Allocation Graph | Operating System - M04 P03

Multi-Instance Resource Allocation Graph | Operating System - M04 P03

ยท

5 min read

This is a multipart blog article series, and in this series I am going to explain you the concepts of operating system. This article series is divided into multiple modules and this is the forth module which consists of 8 articles.

In the previous article we discussed about resource allocation graph for single instance, now in this article we are going to see about multi-instance resource allocation graph.

Multi-instance resource allocation:

  • It means that resource has multiple instances.
  • In simple words we can say that a particular resource can fulfil the need of multiple process requests.

To get a clear understanding of the topic letโ€™s see an example and try to understand.

Example:

Untitled Diagram.png

Process No.Allocated R1Allocated R2Request R1Request R2
P11001
P20110
P30100
  • Current availability: (0,0)
  • With the current availability we can fulfil the request of P3, because P3 is demanding nothing. So, P3 will get terminated after executing completely. Now the availability has changed as resource allocated to P3 has been released by P3.
  • Current availability: (0,1)
  • Now, with the current availability we can fulfil the request of P1, because it requires 1 resource of R2 and we have it. So, P1 will get terminated after getting executed completely and the resource allocated to P1 will be released.
  • Current availability: (1,1)
  • With this availability we can fulfil the request of P2.
  • So, no deadlock is present in the system.
  • This example contains circular wait but no deadlock is present, because this is multi-instance that only happen in the case of single-instance.

Example:

Untitled Diagram (1).png

Process No.Allocated R1Allocated R2Allocated R3Request R1Request R2Request R3
P0101011
P1110100
P2010001
P3010120
  • Current availability: (0,0,1)
  • With current availability we can fulfil the request of P2, it only require 1 resource of R3. It will get terminated and after executing completely.
  • Current availability: (0,1,1)
  • With current availability we can fulfil the request of P0, it require 1 resource of R2 and 1 resource of R3
  • Current availability: (1,1,2)
  • With current availability we can fulfil the request of P1 it requires 1 resource of R1.
  • Current availability: (2,2,2)
  • With current availability we can fulfil the request of P3 it require 1 resource of R1 and 2 resource of R2.
  • No deadlock is present in this example.
  • Current availability: (2,3,2), all resources are free.

So this was all about multi-instance resource allocation graph. Hope you liked it and learned something new from it.

If you have any doubt, question, quires related to this topic or just want to share something new with me, than please feel free to contact me.

๐Ÿ“ฑ Contact Me

Twitter, LinkedIn, Telegram, Instagram,

๐Ÿ“ง Write a mail

rahulmishra102000@gmail.com

GitHub, HackerRank