An operating system uses the Banker's algorithm for deadlock avoidance when managing the allocation of three resource types and to three processes and The table given below presents the current system state. Here, the Allocation matrix shows the current number of resources of each type allocated to each process and the Max matrix shows the maximum number of resources of each type required by each process during its execution.
There are units of type units of type and units of type still available. The system is currently in a safe state. Consider the following independent requests for additional resources in the current state:
REQ1: requests units of units of and units of
REQ2: requests units of units of and units of
Which one of the following is TRUE?
View worked solution
Answer: B
To determine which requests can be permitted, we first calculate the Need matrix using the formula :
The current available resources are .
Evaluating REQ1: requests .
- Since () and (), we temporarily allocate the resources.
- New .
- New Allocation for , and new Need for .
- With , only (Need ) can execute. After finishes, becomes .
- Now, neither (Need ) nor (Need ) can be satisfied. The system is in an unsafe state. Thus, REQ1 cannot be permitted.
Evaluating REQ2: requests .
- Since () and (), we temporarily allocate the resources.
- New .
- New Allocation for , and new Need for .
- With , we can satisfy (Need ). After finishes, becomes .
- Next, we can satisfy (Need ). After finishes, becomes .
- Finally, we can satisfy (Need ).
- Since a safe sequence exists, the system remains in a safe state. Thus, REQ2 can be permitted.
Free practice · Your answers on this page are not saved.
