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 ?
P2 P1 P3
A state is safe if the processes can be ordered so that each one's remaining need can be met from the free drives plus the drives released by the processes finishing before it (Banker's algorithm safety test).
Free drives: \(13-(6+3+2)=2\). Remaining need = Max − Allocation: P1 \(11-6=5\), P2 \(5-3=2\), P3 \(8-2=6\).
With 2 free drives only P2 (need 2) can finish, so every safe sequence starts with P2; sequences starting with P1 fail at once because P1 needs 5. After P2 finishes, free drives = \(2+3=5\).
Now P1 (need 5) can finish, releasing its 6 drives: free = \(5+6=11\), and then P3 (need 6) finishes, giving back all 13. But P3 cannot run second, since it needs 6 while only 5 are free.
So P2 → P1 → P3 is the only safe sequence.
Hence, the answer is P2 P1 P3.
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 :
A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows :
| Allocated | Maximum | Available | |
| Process A | 1 0 2 1 1 | 1 1 2 1 3 | 0 0 \(x\) 1 1 |
| Process B | 2 0 1 1 0 | 2 2 2 1 0 | |
| Process C | 1 1 0 1 0 | 2 1 3 1 0 | |
| Process D | 1 1 1 1 0 | 1 1 2 2 1 |
The smallest value of \(x\) for which the above system in safe state is __________.
Consider a system with five processes \(P_{0}\) through \(P_{4}\) and three resource types \(R_{1}\), \(R_{2}\) and \(R_{3}\). Resource type \(R_{1}\) has 10 instances, \(R_{2}\) has 5 instances and \(R_{3}\) has 7 instances. Suppose that at time \(T_{0}\), the following snapshot of the system has been taken :
Allocation
| \(R_{1}\) | \(R_{2}\) | \(R_{3}\) | |
| \(P_{0}\) | 0 | 1 | 0 |
| \(P_{1}\) | 2 | 0 | 0 |
| \(P_{2}\) | 3 | 0 | 2 |
| \(P_{3}\) | 2 | 1 | 1 |
| \(P_{4}\) | 0 | 2 | 2 |
Max
| \(R_{1}\) | \(R_{2}\) | \(R_{3}\) |
| 7 | 5 | 3 |
| 3 | 2 | 2 |
| 9 | 0 | 2 |
| 2 | 2 | 2 |
| 4 | 3 | 3 |
Available
| \(R_{1}\) | \(R_{2}\) | \(R_{3}\) |
| 3 | 3 | 2 |
Assume that now the process \(P_{1}\) requests one additional instance of type \(R_{1}\) and two instances of resource type \(R_{3}\). The state resulting after this allocation will be
Which data structure does the Banker’s Algorithm use to maintain the state of available, maximum and allocated resources ?
What is the significance of the Banker’s algorithm in terms of resource management ?
Which of the following is NOT a requirement for Banker’s algorithm to grant a resource request ?
What is the primary goal of the Banker’s Algorithm ?
What information is used to determine if a resource request can be granted ?
Suppose a system has 12 magnetic tape drives and at time t 0, three processes are allotted tape drives out of their as given below:
Maximum Needs | Current Needs | |
p 0 | 10 | 5 |
p 1 | 4 | 2 |
p 2 | 9 | 2 |
At time t 0, the system is in safe state. Which of the following is safe sequence so that deadlock is avoided?
NOTE:
Current Need is currently allocated resource to a process
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 :
A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows :
| Allocated | Maximum | Available | |
| Process A | 1 0 2 1 1 | 1 1 2 1 3 | 0 0 \(x\) 1 1 |
| Process B | 2 0 1 1 0 | 2 2 2 1 0 | |
| Process C | 1 1 0 1 0 | 2 1 3 1 0 | |
| Process D | 1 1 1 1 0 | 1 1 2 2 1 |
The smallest value of \(x\) for which the above system in safe state is __________.
Consider a system with five processes \(P_{0}\) through \(P_{4}\) and three resource types \(R_{1}\), \(R_{2}\) and \(R_{3}\). Resource type \(R_{1}\) has 10 instances, \(R_{2}\) has 5 instances and \(R_{3}\) has 7 instances. Suppose that at time \(T_{0}\), the following snapshot of the system has been taken :
Allocation
| \(R_{1}\) | \(R_{2}\) | \(R_{3}\) | |
| \(P_{0}\) | 0 | 1 | 0 |
| \(P_{1}\) | 2 | 0 | 0 |
| \(P_{2}\) | 3 | 0 | 2 |
| \(P_{3}\) | 2 | 1 | 1 |
| \(P_{4}\) | 0 | 2 | 2 |
Max
| \(R_{1}\) | \(R_{2}\) | \(R_{3}\) |
| 7 | 5 | 3 |
| 3 | 2 | 2 |
| 9 | 0 | 2 |
| 2 | 2 | 2 |
| 4 | 3 | 3 |
Available
| \(R_{1}\) | \(R_{2}\) | \(R_{3}\) |
| 3 | 3 | 2 |
Assume that now the process \(P_{1}\) requests one additional instance of type \(R_{1}\) and two instances of resource type \(R_{3}\). The state resulting after this allocation will be
Which data structure does the Banker’s Algorithm use to maintain the state of available, maximum and allocated resources ?