in Theory of Computation
1,872 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>
in Theory of Computation
1.9k views

4 Comments

Sorry i dont know . I iwll see and come back . experts will reply :)
0
0
please write your answers in a presentable form NOT in ALL CAPS, ensure best readability.
0
0

okayyes

0
0

2 Answers

4 votes
4 votes
Best answer

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

3 Comments

I got your solution :) But i have a doubt they say the process has resources , They didnt mean they need those amount of resources !
0
0
with a similar logic the question does not precisely say that it talks of resources rather it talks "RESOURSE". Sometimes we have to logically make up ourselves what is being asked.
0
0
Yes i agree . Thanks
0
0
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