Thursday 22 October 2020

Minimum number of resource for deadlock free system

 



Consider there are n processes in the system P1, P2, P3, …… , Pn where-


Process P1 requires x1 units of resource R

Process P2 requires x2 units of resource R

Process P3 requires x3 units of resource R and so on.


In worst case,


The number of units that each process holds = One less than its maximum demand

 


So,


Process P1 holds x1 – 1 units of resource R

Process P2 holds x2 – 1 units of resource R

Process P3 holds x3 – 1 units of resource R and so on.

 


Now,


Had there been one more unit of resource R in the system, system could be ensured deadlock free.

This is because that unit would be allocated to one of the processes and it would get execute and then release its units.


So, Maximum number of units of resource R that ensures deadlock


= (x1-1) + (x2-1) + (x3-1) + …. + (xn-1)


= ( x1 + x2 + x3 + …. + xn ) – n


= ∑xi – n


= Sum of max needs of all n processes – n


Minimum Number Of Units That Ensures No Deadlock-

 


Minimum number of units of resource R that ensures no deadlock


= One more than maximum number of units of resource R that ensures deadlock


= (∑xi – n) + 1



or 

R > = P * ( N - 1 ) + 1


Where R is the minimum number of resources

P is the number of processes

N Max need for each process


No comments:

Post a Comment