117 views
3 3 votes

A system has three processes $P_0, P_1, P_2$ and three resource types $A, B, C$. At a particular instant:

$$\begin{array}{|c|c|c|}
\hline
\text{Process} & \text{Allocation }(A,B,C) & \text{Need }(A,B,C) \\
\hline
P_0 & (2,0,1) & (0,2,1) \\
P_1 & (0,2,0) & (1,2,3) \\
P_2 & (1,0,1) & (0,1,3) \\
\hline
\end{array}$$

The currently available resources are $(1,3,2)$.

How many safe sequences exist?

  1. $1$
     
  2. $2$
     
  3. $3$
     
  4. $4$

1 Answer

0 0 votes

Initially,

$Work=(1,3,2)$.

Compare each process's Need with Work:

  • $P_0:(0,2,1)\leq(1,3,2)$, so $P_0$ can complete.
  • $P_1:(1,2,3)\nleq(1,3,2)$ because $3>2$ for resource $C$.
  • $P_2:(0,1,3)\nleq(1,3,2)$ for the same reason.

Therefore the first process is forced to be $P_0$.

After $P_0$ finishes:

$Work=(1,3,2)+(2,0,1)=(3,3,3)$.

Now both remaining processes can finish:

$P_1:(1,2,3)\leq(3,3,3)$

and

$P_2:(0,1,3)\leq(3,3,3)$.

So the two possible safe sequences are:

$P_0\rightarrow P_1\rightarrow P_2$

and

$P_0\rightarrow P_2\rightarrow P_1$.
 

So, Answer : $\boxed{2}$

Answer:
Position:
Show:

Related questions

5 5 votes
1 1 answer
113
113 views
GO Classes asked Aug 20
113 views
A system contains:$12$ units of resource $R$$24$ units of resource $S$It is managed using Banker's Algorithm.Maximum claims:$P_1:(0,12)$$P_2:(8,15)$$P_3:(8,20)$Current al...
5 5 votes
1 1 answer
94
94 views
GO Classes asked Aug 20
94 views
Consider the following system:$$\begin{array}{|c|c|c|}\hline\text{Process} & \text{Allocation }(A,B,C,D) & \text{Max }(A,B,C,D) \\\hlineP_0 & (0,0,1,2) & (0,0,1,2) \\P_1 ...
4 4 votes
1 1 answer
81
81 views
GO Classes asked Aug 20
81 views
A system has resource types $A, B, C$ and four threads.The total number of resource instances is:$(A,B,C)=(11,21,19)$The current allocations and maximum requirements are:...
3 3 votes
1 1 answer
72
72 views
GO Classes asked Aug 20
72 views
A system contains $4$ identical instances of a resource.Three processes have the following maximum requirements and current allocations:$$\begin{array}{|c|c|c|}\hline\tex...