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?
- 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
3then deadlock will occur. In that case there could be a scenario that
2instance of resource and want one more while the other two instance of resource are allocated to
P3who 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.