127 views
5 5 votes

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 allocations are:

$P_1:(0,4)$

$P_2:(8,0)$

$P_3:(0,8)$

There are no outstanding requests.

Let,

  • $x_1$ be the maximum additional units of $S$ that $P_1$ can request and be granted immediately.
  • $x_2$ be the corresponding maximum for $P_2$.
  • $x_3$ be the corresponding maximum for $P_3$.

Which triple is correct?

  1. $(8,4,1)$
     
  2. $(8,5,1)$
     
  3. $(8,4,4)$
     
  4. $(8,8,1)$

1 Answer

1 1 vote

Current total allocation:

$R=8$

$S=4+8=12$.

$\therefore Available=(12-8,24-12)=(4,12)$.

Initial remaining needs:

$P_1:(0,8)$

$P_2:(0,15)$

$P_3:(8,12)$.


Part $1:$ Maximum request by $P_1$

Suppose $P_1$ requests $x$ units of $S$.

Its remaining need becomes: $(0,8-x)$.

Available becomes: $(4,12-x)$.

For every $x\leq8$:

$8-x\leq12-x$.

So $P_1$ itself can always be guaranteed to finish.

Its maximum remaining claim is only $8$ units.

$\boxed{\therefore x_1=8}$.


Part $2:$ Maximum request by $P_2$

Suppose $P_2$ receives $x$ units of $S$.

Available becomes: $(4,12-x)$.

Its remaining need becomes: $(0,15-x)$.

$P_2$ cannot be the first process to finish because $15-x>12-x$ for every $x$.

$P_3$ cannot finish first either because it still requires $8$ units of $R$, while only $4$ are available.

Therefore $P_1$ must finish first.

For $P_1$ to finish:

$8\leq12-x$.

$\Rightarrow x\leq4$.

At $x=4$:

Available becomes $(4,8)$.

$P_1$ can finish and release its current 4 units of $S$:

$Work=(4,12)$

Now $P_2$ has remaining need $(0,11)$, which can be met.

So, $\boxed{x_2=4}$.


Part $3:$ Maximum request by $P_3$

Suppose $P_3$ receives $x$ additional units of $S$.

Available becomes $(4,12-x)$.

$P_3$ still cannot finish first because it needs 8 additional units of $R$.

Again, $P_1$ must finish first.

This requires:

$8\leq12-x$

$\Rightarrow x\leq4$

After $P_1$ finishes,

$Work=(4,16-x)$.

Before $P_3$ can complete, we need $P_2$ to finish and release its 8 units of $R$.

For $P_2$ to finish:

$15\leq16-x$.

$\Rightarrow x\leq1$.

For $x=1$, a safe order is:

$P_1\rightarrow P_2\rightarrow P_3$.

$\boxed{\therefore x_3=1}$.

Thus, $(x_1,x_2,x_3)=\boxed{(8,4,1)}$
 

Answer : A

Answer:
Position:
Show:

Related questions

4 4 votes
1 1 answer
128
128 views
GO Classes asked Aug 20
128 views
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 }...
6 6 votes
1 1 answer
97
97 views
GO Classes asked Aug 20
97 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
89
89 views
GO Classes asked Aug 20
89 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:...
4 4 votes
1 1 answer
78
78 views
GO Classes asked Aug 20
78 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...