Question on Deadlock | Operating System - M04 P08

Subscribe to my newsletter and never miss my upcoming articles

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 this article we will see a question based on the concept of deadlock in an operating system, and try to get better understanding of the concept.

Question: Consider a system with 3 processes that share 4 instances of same resource type. Each process can request a max of K instances. The largest value of K that will always avoid deadlock is? Answer:

  • The value of K = 2
  • The value of k will be two because, if the value of k is one then also no deadlock will occur but question is asking for maximum value.
  • If the value of k will be 3 then deadlock will occur. In that case there could be a scenario that P1 process has 2 instance of resource and want one more while the other two instance of resource are allocated to P2 and P3 who also want more instances of resource to get completely execute, in this case what is happening that no process can completes its execution and hence deadlock will occur.
  • Therefore the maximum value of K for which deadlock will not occur will be 2.

So this was all about a simple question on deadlock in an operating system. 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 with me, than please feel free to contact me.

📱 Contact Me

Twitter, LinkedIn, Telegram, Instagram,

📧 Write a mail

rahulmishra102000@gmail.com

GitHub, HackerRank

No Comments Yet