in Operating System edited by
13,610 views
28 votes
28 votes

A system shares $9$ tape drives. The current allocation and maximum requirement of tape drives for that processes are shown below:

$$\begin{array}{ccc}  \textbf{Process} & \textbf{Current Allocation} & \textbf{Maximum Requirement} \\ \text{P1} & 3 & 7 \\ \text{P2} & 1 & 6 \\ \text{P3} & 3 & 5 \\  \end{array}$$

Which of the following best describes current state of the system?

  1. Safe, Deadlocked
  2. Safe, Not Deadlocked
  3. Not Safe, Deadlocked
  4. Not Safe, Not Deadlocked
in Operating System edited by
by
13.6k views

4 Comments

incorrect options plzz correct it..
0
0
Confused regarding Deadlock..
Given total number of drives=  9
         P1 max. requirement = 7
         P2 max. requirement  = 6
         P3 max. requirement = 5
Now For three processes to be not in deadlock with max. requirements of 7 6 and 5,
No. of resources required= (6+5+4) + 1 = 16
But given No. of resources = 9
So deadlock will happen.
1
1
it is not possible to be deadlocked if the state is safe so clearly option A is wrong.
and B is the correct answer
order -p3--p2--p1 or p3--p1--p2
1
1

There can never be a deadlock in safe state ..This clearly eliminate Option A 

6
6

7 Answers

46 votes
46 votes
Best answer

$$\small\begin{array}{|c|c|c|c|} \hline \textbf{Process} & \textbf{Current Allocation} & \textbf{Max Requirement}& \textbf{Need} \\\hline \text{P1} & 3 & 7 & 4 \\\hline \text{P2} & 1 & 6 & 5 \\\hline \text{P3} & 3 & 5  & 2\\\hline  \end{array}$$Given there are total $9$ tape drives,

So, according to the above table we can see we have currently allocated ($7$ tape drive), so currently Available tape drives $= 2$

So, $P3$ can use it and after using it will release it $3$ resources New Available $=5$

then $P1$ can use it and will release it $3$ resources so New Available $= 8$

and lastly $P2$ so, all the process are in SAFE STATE and there will be NO DEADLOCK

Safe Sequence will be $\bf P3\to P2\to P1$ or $\bf P3\to P1 \to P2.$

Answer will be (B) only.

edited by

4 Comments

@Arjun Sir, @Bikram Sir, what if one instance of tape is given to P1, and another instance is given to P2, and now deadlock will occur right? Please someone reply me.

0
0
@VS @rio

This answer will surely clear you'r doubts👍
https://cs.stackexchange.com/a/45149
5
5

In safe state,deadlock is not possible.(eliminates option A)

But,in unsafe state,we cannot say anything about it;deadlock may or may not occur(eliminates options C and D)

Thus,we can answer it without even solving that answer will be B.

Correct me if I'm wrong.

1
1
10 votes
10 votes
b) safe state , not deadlocked

we can execute in the order p3,p1 ,p2

 or p3,p2, p1
9 votes
9 votes

hope it might help.........

6 votes
6 votes

Require P1 =7-3 =4

           P2 =6-1 =5  

           P3 =5-3 =2

Available 9-(3+1+3) =2

P3->P2->P1

OR

P3->P1->P2

Hence Safe and NO Deadlocked

Ans B

Answer:

Related questions