in Operating System
405 views
1 vote
1 vote
Given a system with 3 processes where each process requires at least 2 resources to complete their execution, then the largest number of resources which will guarantee a deadlock is ___


 

I answered it as 3. Because it asked for maximum which is not correct. Can someone help me in this.

in Operating System
405 views

1 Answer

1 vote
1 vote
You have answered 3 which is correct.

Let each process acquire 1 resource each. Then each one would need 1 more resource. Now the minimum number of resources which will guarantee deadlock is never reached is 3 + 1 = 4. Hence the maximum number of resources which would lead to a deadlock is 3.

2 Comments

each process requires at least 2 resources to complete their execution

Question is saying at least 2 resources are needed to complete their execution, there is a slight variation in the question.

If they require exactly(lower bound on at least) 2 resources per process then, to have a deadlock in the worst case, each process gets 1 resource each. Therefore, 3 resources can have deadlock. 

But if 1 process gets 2 resources (and if its requirement matches) then it is able to complete. 

Likewise, 2 resources can also dissatisfy deadlock. 

So, if there is only one resource, then there is no way a deadlock can be escaped.

1 should be the right answer.

3
3

@LRU Yes your observation is correct. with 1 resource it is impossible to escape deadlock. The answer should be 1.

1
1

Related questions