CS FundamentalsVery hardGATE CS
Banker's algorithm state: Available = (3,3,2). Allocation: P0 (0,1,0), P1 (2,0,0), P2 (3,0,2), P3 (2,1,1), P4 (0,0,2). Max: P0 (7,5,3), P1 (3,2,2), P2 (9,0,2), P3 (2,2,2), P4 (4,3,3). Considered separately (each against this same state), what happens to the requests P4 → (3,3,0), P0 → (0,2,0) and P1 → (1,0,2)?
- A. P4: denied (unsafe); P0: granted; P1: granted
- B. All three can be granted
- C. P4: denied (unsafe); P0: denied (unsafe); P1: granted
- D. P4: must wait (exceeds Available); P0: granted; P1: granted
Correct answer: A. P4: denied (unsafe); P0: granted; P1: granted
P4's (3,3,0) is within its need (4,3,1) and within Available, but it would leave Available (0,0,2), enough for nobody: unsafe, so denied. P0's (0,2,0) leaves (3,1,2): P3 (need 0,1,1) can finish, then P1, P0, P2, P4, so it is safe and granted. P1's (1,0,2) leaves (2,3,0) and P1, P3, P4, P0, P2 is safe. (The well-known denial of P0's request happens only AFTER P1's request has been granted.)
More Operating Systems questions
- Two resource types X, Y. Available = (1,1). Allocation: P0 (1,0), P1 (0,1), P2 (1,1). Max: P0 (2,1), P1 (1,2), P2 (2,2). How many of the…
- A system has R identical instances of a resource shared by 4 processes needing at most 3, 4, 5 and 2 instances respectively. What is the…
- n processes share 12 identical units of a resource, and each process may need up to 4 units. What is the largest n for which deadlock is…
- k processes each need at most 3 instances of a resource that has 7 instances in total. Requests are made one instance at a time. What is…
- Deadlock detection (multi-instance). Available = (0,0,0). Allocation: P0 (0,1,0), P1 (2,0,0), P2 (3,0,3), P3 (2,1,1), P4 (0,0,2). Current…
- In a resource-allocation graph where EVERY resource type has exactly one instance, which statement is correct?