Question on Deadlock | Operating System - M04 P07

Question on Deadlock | Operating System - M04 P07

ยท

3 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 this article we will see one question based on the concept of deadlock in an operating system.

Question: A system is having 3 processes each requires 2 units of resources R. The minimum number of units of R requires such that no deadlock will occur?

  1. 3
  2. 5
  3. 6
  4. 4

Answer:

  • (d) 4 resources
  • We need 4 resources of R because then in worst condition when all the processes request for resource we can give one resource to every process and still one resource will be remaining.
  • If we give that resource to any process than it will get terminate because one process require only two resources and when they get that their execution will be complete.
  • Now we have two free resources and two processes that need two resources and hence they will also get executed and thus no deadlock will occur.
  • If we take 3 resource than deadlock will occur and we are not taking 5 or 6 because we need to find minimum number of resources.

So this was 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