The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+2 votes

Consider a system with twelve magnetic tape drives and three processes $P_1, P_2$ and $P_3$. process $P_1$ requires maximum ten tape drives, process $P_2$ may need as many as four tape drives and $P_3$ may need upto nine tape drives. Suppose that at time $t_1$, process $P_1$ is holding five tape drives, process $P_2$ is holding two tape drives and process $P_3$ is holding three tape drives, At time $t_1$, system is in:

  1. safe state
  2. unsafe state
  3. deadlocked state
  4. starvation state
in Operating System by Veteran (103k points)
edited by | 1.9k views

3 Answers

+3 votes
Best answer

System is in UNSAFE state

  • P1  holds  5 tapes
  • P2 holds 2  tapes
  • P3 holds 3  tapes

Total 10 tapes are allocated and 12-10=2 tapes are free

  • P1 requires maximum 10 tape drives; It needs 10-5 =5 more tapes
  • P2 may need as many  as 4tape drives. It needs 4-2=2 more tapes.
  • P3 may need as many as 9 tape drives. It needs 9-3=6 more tapes.

We can allocate 2 free tapes to P2.

P2 will complete execution and release all its resources including 4 tapes.

Even if we allocate 4 tapes to P1 or P3 they cannot complete execution because P1 nees 5 more taps while P3 needs 6 more tapes.

System is in unsafe state.!!!

by Boss (32.2k points)
selected by
+3 votes

At time T1
Maximum need P1  P2  P3
10 4 9
Allocated P1  P2  P3
5 2 3
Total tape drives = 12
Available tape drives = 12-(Allocated tape drives)
= 12 - (10)=2
Need  P1  P2  P3
5 2 6
So process P2 needs 2 tap drives and we have available 2.
So P2 satisfies is need at t1 After this Available becomes 4
So we can see neither P1 nor P3 need satisfies so system no longer becomes 
safe and System goes to unsafe state at time t1

by Boss (45.2k points)
0 votes

System is unsafe .


Processes Used Max Need
P1 5 10 5
P2 2 4 2
P3 3 9 6

Now Available A=12-(5+3+2)=2

Anew=2,With Anew we can only fulfil the desire of P2

Now Anew=2+2=4

Anew=4::: With Anew=4 we are totaly unable to fulfill the need of P1 and P3.So there is no sequence exist by which we can say system in safe.

by Loyal (9.9k points)
@Paras+Nath Suppose we had $11$ tape drives instead of $12$, then there would be a deadlock?
if we had 11 tape drives then we hav only 1 available resource....and we are not able fulfil need of any process....I think in this condition we still in deadlock!!

correct me if im wrong...

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,339 questions
55,765 answers
90,815 users