edited by
1,667 views
16 votes
16 votes
A system has $4$ processes $A$, $B$, $C$, $D$ and $5$ allocatable resources $R_1, \: R_2,\: R_3, \: R_4,\: R_5$. The maximum resource requirement for each process and its current allocation are as follows:

$$\begin{array}{|c|c|}\hline \textbf{Process}  &  \textbf{Maximum} & \textbf{Allocation} \\ & R_1, R_2, R_3, R_4, R_5 & R_1, R_2, R_3, R_4, R_5 \\ \hline \text{A} & 1, 1, 2, 1, 3 & 1, 0, 2, 1, 1  \\  \text{B} & 2, 2, 2, 1, 0 & 2, 0, 1, 1, 0  \\  \text{C} & 2, 1, 3, 1, 0 & 1, 1, 0, 1, 0  \\ \text{D} & 1, 1, 2, 2, 1 & 1, 1, 1, 1, 0 \\ \\\hline \end{array}$$
Suppose the currently available count of resources is given by $0, \: 0,\: X,\: 1,\: 1$. What is the minimum value of $X$ for which this is a safe state? Justify your answer.
edited by

1 Answer

Best answer
23 votes
23 votes
Whatever be the value of $X$, system cannot be in safe state

Here, we know Maximum available resources and current allocations

We have to figure out Need Matrix  to find safe state

$$\overset{\textbf{Need Matrix}}{\begin{array}{|l|l|l||l|l|}\hline &
\textbf{$R_1$} & \textbf{$R_2$} & \textbf{$R_3$} &\textbf{$R_4$}  & \textbf{$R_5$} \\\hline  \textbf{A} & \text{0} & \text{1} & \text{0} & \text{0} & \text{2}\\ \textbf{B} & \text{0} & \text{2} & \text{1} & \text{0}& \text{0}\\ \textbf{C} & \text{1} & \text{0} & \text{3} & \text{0}& \text{0}\\ \textbf{D} & \text{0} & \text{0} & \text{1} & \text{1} & \text{1}
\\\hline\end{array}}$$
Now our available vector is $( 0,0,X,1,1)$

We might think with $X=1,$ D can execute and this is a safe state. But even if $D$ executes, system is not in safe state as process $A$ cannot finish execution as it needs $2$ more instances of $R_5$ and only $1$ is available including those which are allocated to all the processes. So, there is no way process $A$ can proceed and this ensure system state is not safe.
Suppose with $X=1$, $D$ executes.

After executing  $D$ releases $(1,1,1,1,0)$

Now available resource vector is $\bf{( 1, 1, 2, 2, 1 )}$
which can not fulfill the resource requirement of $A,B$ or $C$

Now, suppose $X=2$

Then $C$ executes and released its resources $(1,1,0,1,0)$

Now available resources vector will be $\bf{(2,2,3,3,1)}$

With this $B$ can execute and release its resources $(2,0,1,1,0)$

Now available resource vector will be  $\bf{(4,2,4,4,1)}$

But with this $A$ cannot execute as, $A$ need $(0,1,0,0,2)$

So, the system cannot be in safe state for any value of $X$.
edited by

Related questions

1 votes
1 votes
0 answers
2
go_editor asked Jun 1, 2016
513 views
A connected, simple, undirected planar graph $G(V, E)$ is given where $V$ denotes the set of vertices and E denotes the set of edges. In $V$, there is a designated source...
2 votes
2 votes
2 answers
4
go_editor asked Jun 1, 2016
1,052 views
A block of bits with $n$ rows and $m$ columns uses horizontal and vertical parity bits for error detection. If exactly 4 bits are in error during transmission, derive an ...