Anonymous user menu


Consider 'n' processes sharing 'm' instances of a resource type R. Each process Pi requires minimum Xi and maximum Yi instances of resource R, where 1 <= i <= n.

What should be the minimum value of 'm' for which deadlock do not occurs ?


Answer: D

Abhinav Arora @abhinav93
2 Feb 2017 12:50 pm

The answer should be -n+1 not +n-1 


vaishali trivedi @vaishalitrivedi
2 Feb 2017 12:53 pm

it should be -n+1 

Ashish Kumar Goyal @dashish
2 Feb 2017 02:58 pm

All the options are incorrect

Sumit Verma @sumitverma
2 Feb 2017 03:57 pm

That was typing mistake.
Correct answer will include -n+1 as commented by @abhinav93 and @vaishalitrivedi.
This will not be considered in marking.

Charan @harisadu
14 Oct 2018 09:01 pm
When a process requires Minimum Xi resources why care about maximum. It can complete its execution by using up minimum required resources. Can someone explain why it is Yi-n+1?
Ashish Kumar Goyal @dashish
15 Oct 2018 03:43 pm

The process requires minimum Xi resources and doesn't mean that it can complete its execution with that much resources.

These indicates that during its execution at any point, the minimum no. of resources required is Xi and maximum resources required by it at any instance is Yi.

So, now coming to the question, Have to find the min. no of resource instances required such that no deadlock occur. So, we do this by first finding the max. no of resources for which deadlock will occur, and then just add 1 more resource and the deadlock can be escaped.

For max instances of resource for which deadlock occurs, assume the situation where all the instances are occupied and each process is waiting for a single instance of resource to complete its execution. So, each process i holds Yi-1 instances of resource. and since all are blocked, so deadlock. Now if u provide an additional instance then some resource can take it and finish its execution and then release all Yi instances it was holding and then the other process may start take those instances and deadlock will be avoided.


Therefore, min instances required to avoid deadlock =  \sum_{i=1}^{n}\left ( Y_{i} -1 \right ) +1 = \sum_{i=1}^{n}Y_{i} -n +1