451 views

A system is having user processes $P_1, P_2, \dots , P_N$ each requiring $Q_N, Q_{N-1}, \dots , Q_1$ number of resource instances of resource $R$. The minimum number of resource instances of $R$ to guarantee that deadlock will not occur is

1. $NQ_N - N+1$
2. $NQ_1 + N-1$
3. $(Q_1 + Q_2 + … + Q_N) + N – 1$
4. $(Q_1 + Q_2 + … + Q_N) + 1 – N$

### 1 comment

@Ruturaj Mohanty typo! it should have been QN,QN-1,…,Q1 in the question.

The sum of the maximum requirement of the processes is $Q1 + Q2 + Q3 + ........ + Qn.$

Number of minimum resources are needed to ensure deadlock doesn't occur, sum all the maximum requirements of all the processes  and subtract 1 from each and then give one more resource any of the processes:

$[(Q1-1) + (Q2-1) + (Q3-1) + ........ + (Qn-1)] +1$

which is $(Q1 + Q2 + Q3 + ........ + Qn) - N + 1$

Hence, option (D) is correct!