18.
Consider a system with five processes P0 through P4 and three resource types R1, R2 and R3. Resource type R1 has 10 instances, R2 has 5 instances and R3 has 7 instances. Suppose that at time T0, the following snapshot of the system has been taken :
| Allocation | Max |
|---|
| R1 R2 R3 | R1 R2 R3 |
| P0 | 0 1 0 | 7 5 3 |
| P1 | 2 0 0 | 3 2 2 |
| P2 | 3 0 2 | 9 0 2 |
| P3 | 2 1 1 | 2 2 2 |
| P4 | 0 2 2 | 4 3 3 |
Available : R1 = 3, R2 = 3, R3 = 2. Assume that now the process P1 requests one additional instance of type R1 and two instances of resource type R3. The state resulting after this allocation will be
Exam Year(s)
UGC NET - 2014,
Answer: B
The resulting state is a safe state. The request of P1 is (1, 0, 2). Its need is Max minus Allocation, (1, 2, 2), so the request is within its need, and it is within the available (3, 3, 2). After the grant the available is (2, 3, 0), P1 holds (3, 0, 2) and needs (0, 2, 0). The processes can then finish in the order P1, P3, P0, P2, P4 or any order that works, for example P1 needs (0, 2, 0), which is available, and returns its resources, after which the available grows to (5, 3, 2), then (7, 4, 3) after P3, and every other need is covered. As a safe sequence exists, the state is safe, not unsafe, and ready and blocked are process states, not states of allocation.