Friday 3 July 2015

Q 52,p3,d14.An operating system has 13 tape drives. There are three processes P1, P2 & P3. Maximum requirement of P1 is 11 tape drives, P2 is 5 tape drives and P3 is 8 tape drives. Currently, P1 is allocated 6 tape drives, P2 is allocated 3 tape drives and P3 is allocated 2 tape drives. Which of the following sequences represent a safe state ?



(A) P2 P1 P3 
(B) P2 P3 P1
(C) P1 P2 P3 
(D) P1 P3 P2

Answer A.
Explanation.


                                     
Allocated
max demand 
max demand-allocation
P1
p2
          p3
                    p1
          p2
          p3
                    p1
          p2
          p3
6
3
2
11
5
8
5
2
6

Total tapes 13. Allocated 11. Balance 2.
So first 2 units are given to p2. Then after completion p2 returns all 5.
Now 5 units are catered to p1. Now p1 returns 11 units.
Which can easily be given to p3.
Hence order is p2,p1,p3.
See banker's algo for detail.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.