The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+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:

- safe state
- unsafe state
- deadlocked state
- starvation state

+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.

+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

0 votes

System is unsafe .

Explanation

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.

- All categories
- General Aptitude 1.8k
- Engineering Mathematics 7.3k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.1k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.6k
- Others 1.8k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,339 questions

55,765 answers

192,354 comments

90,815 users