edited by
34,201 views
67 votes
67 votes

Consider a system with $4$ types of resources $R1$ ($3$ units), $R2$ ($2$ units), $R3$ ($3$ units), $R4$ ($2$ units). A non-preemptive resource allocation policy is used. At any given instance, a request is not entertained if it cannot be completely satisfied. Three processes $P1$, $P2$, $P3$ request the resources as follows if executed independently.

$$\begin{array}{|l|l|l|}\hline \textbf{Process P1:}  &  \textbf{Process P2:} & \textbf{Process P3:}  \\ \hline \text{$t=0$: requests $2$ units of $R2$} & \text{$t=0$: requests $2$ units of $R3$} & \text{$t=0$: requests $1$ unit of $R4$} \\ \text{$t=1$: requests $1$ unit of $R3$} & \text{$t=2$: requests $1$ unit of $R4$} & \text{$t=2$: requests $2$ units of $R1$}\\\text{$t=3$: requests $2$ units of $R1$} & \text{$t=4$: requests $1$ unit of $R1$} & \text{$t=5$: releases $2$ units of $R1$} \\ \text{$t=5$: releases $1$ unit of $R2$} & \text{$t=6$: releases $1$ unit of $R3$} & \text{$t=7$: requests $1$ unit of $R2$} \\ \text{and $1$ unit of $R1$}& \text{$t=8$: Finishes} & \text{$t=8$: requests $1$ unit of $R3$}\\
\text{$t=7$: releases $1$ unit of $R3$} && \text{$t=9$: Finishes} \\ \text{$t=8$: requests $2$ units of $R4$} & \text{} \\ \text{$t=10$: Finishes} & \text{}  \\ \hline \end{array}$$
Which one of the following statements is TRUE if all three processes run concurrently starting at time $t = 0$?

  1. All processes will finish without any deadlock

  2. Only $P1$ and $P2$ will be in deadlock

  3. Only $P1$ and $P3$ will be in deadlock

  4. All three processes will be in deadlock

edited by

10 Answers

6 votes
6 votes
The answer is A.

Can be solved by making respective tables for each process at different time instances.
3 votes
3 votes
Here hold and wait voilated so there will not be deadlock
2 votes
2 votes
At=3,available R1=1,but P1 needs 2 R1.
        so,P1 is blocked.
At t=5, 3R1 are released,but previously blocked P1 takes 2 R1
         to unblock it.so available R1=1.
At t=8, P2 finishes,so it will releases what it grabbed.
           From the process P2 column in question we can
          see it releases 1 R1,1R3 and 1R4,but at the same time P1 wants
          2 R4 but available is just 1.so P1 is blocked.P3 wants 1 R3 ,it can 
          be fulfilled.
At t=9,P3 finishes ,it releases 1 R2,1 R3,1 R4.So now previously blocked P1
         can be unblocked
At t=10,All finishes.
 
So at last none of the processes are blocked.
So,All processes will finish without deadlock. 
Answer:

Related questions