##### what is the maximum number of processes we can allow such that deadlock will never arise

**A computer has 5 instances of resources types R.if each process require maximum three instance,then what is the maximum number of processes we can allow such that deadlock will never arise?**

**A**)2

B)3

C)4

D)1

given ans is 2

but i got 3 by below method

total instance < No. of processes + resource taken by each process

5< n+3

2<n

**so my ans is 3**

plzzz give valid ans

Ans : 2

If you take 3 processes in some cases deadlock may come

suppose P1=2( 2 resources are allocated to P1)

P2=2( 2 resources are allocated to P2)

P3=1( 1 resource allocated to P3)

from the above example no resource is free and all processes are waiting for resources---so deadlock

yaaa right but according to formula why it is wrong???

your formula is right @meet ,there n(no.of processes) is min no.of processes required to dead lock occur.

you got n=3 ,it means min 3 processes are required to dead lock to happen,but question is max no.o processes are required such that dead lock will never arise.

Therefore min 3 processes are required to dead lock occur.max of 2 processes are required for which there is no dead lock

but i always use this formula for deadlock free system

and i get correct ans till...

suppose u use this formula reverse manner ..

exa: for finding how many maximum resource are aquired by each process and suppose they give to no. of processes are 3 (according to my ans) then

5< 3 + X(maximum resource are aquired by each process)

2<X

therefore X=3 which is satisfied ...

howw?????????

@meet pls have a look.

.

a/c to your formula, total instance < No. of processes + resource taken by each process

answer of this ques will be , m < n + S

_{i}@tinudahiya See this doubts for your above questions. It has already been answered.

http://www.techtud.com/doubt/suppose-n-processes-p1-%E2%80%A6-pn-share-m...