1,867 views
0 votes
0 votes
FOUR PROCESSES P1,P2,P3,P4 HAS RESOURSE R1,R2  AS ,<4,3>,<2,4>,<3,6>,<2,8> WHAT SHOULD BE THE MINIMUM INSTANCES OF R1 AND R2 TO ENSURE THAT IT IS DEAD LOCK FREE????

CAN ANYONE EXPLAIN ME BRIEFLY HOE TO SOLVE THIS PROBLEM

GIVE EXPLANATION TO U R ANSWER

THE ANSWER IS <8,18>

2 Answers

Best answer
4 votes
4 votes

answer is <8,18>

$\text{Minimum Count of a Resource Required} = \left(\sum_{i=1}^{4}{r_i-1}\right) + 1 \\ \text{where i is the process number} \\ r_i \text{ is the max need of the resource, by the } i^{th} \text{ process under consideration}$

to get the minimum number of instances for resource R1, satisfy each process with $\text{(needed number of resource)}-1$ then add $1$ to the count. The extra addition of 1 more instance of the resource R1 will ensure escape from the deadlock in the worst possible case of resource allocation among processes.
so, the minimum count of resource R1 req. for a deadlock free case = (3+1+2+1)+1 = 8

Apply similar procedure taking R2 only. We will get $(2+3+5+7)+1 = 18$

selected by
0 votes
0 votes

At <8,18> there will be deadlock.

consider this: 

process r1 -max  r1 allocated r2-max  r2 allocated
p1 4 3 3 2
p2 2 1 4 3
p3 3 2 6 5
p4 2 1 8 7
  total:  7   17

but even when we increase the instance of resources by 1 for each resource there are still chances of deadlock.

consider this: In the above scenario, p1-4 put of 4 instances of r1 but still need 1 instance of r2 resource

p3 got one extra instance of r2 resource. ie. p3 has 2 out of 3 instances of r1 and all 6 instances. in this case also none of the process will continue their execution. i.e deadlock still exists.

for this to remove deadlock, we need to satisfy the need of one resource completely i.e 7+4 for r1 to have its resource requirement full(so that r1 does not leads to deadlock in any scenario), then 17 +1 so than any one of the 4 process arrives deadlock never happens.

Answer should be <11, 18>.

Related questions

0 votes
0 votes
0 answers
2