427 views

Consider a system having ‘m’ resources of the same type. The resources are shared by 3 processes A, B and C which have peak time demands of 5, 7 and 4 respectively. The minimum value of ‘m’ that will ensure that deadlock will never occur is _____.

### 1 comment

Number of minimum resources that ensure deadlock will never occur are 4 + 6 + 3 +1 =14. Just give each process one resource less than there peak demand, this is number of  maximum resources that will ensure deadlock so adding one more resource into this gives minimum resources ensuring no deadlock.

If a process is demanding ‘x’ resource let’s first give (x-1) instances of resource to it.

Process 1: 4

Process 2: 6

Process 3: 3

Now taking one more instance of resource will ensure that one of the process will complete its execution and free all the resources it had, which is then acquired by other process to complete its execution.

Therefore 4+6+3+1= 14 instances of the resources will ensure that deadlock will never occur.

by
Let there n process P1, P2, P3, P4, …., Pn and maximum need of each process be X1, X2, X3, X4, …., Xn.

Deadlock will not occur if following condition is satisfied :

(X1 – 1) + (X2 – 1) + (X3 – 1) + (X4 – 1) + ….. + (Xn – 1)  + 1  <= R

Given that there ‘m’ resources of the same type and n = 3 processes.

Maximum need of process A = 5

Maximum need of process B = 7

Maximum need of process C = 4

So, (5 – 1) + (7 – 1) + (4 – 1) + 1 <= m

i.e. 4 + 6 + 3 + 1 <= m

i.e. m >= 14

Thus, minimum value of ‘m’ that will ensure that deadlock will never occur = 14
by