Question
A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for three processes are shown below:
| Process | Current Allocation | Maximum Requirement |
|---|---|---|
| P1 | 3 | 8 |
| P2 | 1 | 6 |
| P3 | 3 | 5 |
Which of the following best describes current state of the system?
Official answer and solution
- Official answer
- B
- From
- Official GATE 2017 answer key
Solution
Run Banker's safety algorithm to determine whether the system is in a safe state and check for deadlock.
Calculate currently allocated resources and available resources:
- Total tape drives .
- Current allocation: .
- Total allocated .
- Available drives .
Calculate the Need vector for each process ():
Run the safety algorithm with :
- Check : . can finish and release its allocated 3 tape drives.
New available . - Check : . can finish and release its allocated 3 tape drives.
New available . - Check : . can finish and release its allocated 1 tape drive.
New available .
A valid safe sequence exists. Therefore, the system is in a Safe state. A safe state is by definition Not Deadlocked.
This matches option B.
B
Assuming that having only 2 available drives while P1 and P2 need 5 means the system is unsafe; P3 can complete first and free up sufficient drives.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2017 Computer Science and Information Technology (CS) Session 2
- Question
- 33 of 65, printed as CS Q.33
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.