GATE CS 2017 Set 2 — Question 33
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MCQ+2 / -0.67EasyBanker's AlgorithmDeadlocksOperating SystemDeadlock Numericals
Operating System → Deadlocks → Banker's Algorithm
Last updated
Question
A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for three processes are shown below:
Which of the following best describes current state of the system?
| Process | Current Allocation | Maximum Requirement |
|---|---|---|
| P1 | 3 | 7 |
| P2 | 1 | 6 |
| P3 | 3 | 5 |
Correct answer
(B) Safe, Not Deadlocked
Solution
To determine if the system state is safe, we use the Banker's algorithm (Safety Algorithm).
Total Allocation = 3 + 1 + 3 = 7 tape drives.
Available = Total Resources - Total Allocation
Available = 9 - 7 = 2 tape drives.
Available = 2
The safe sequence so far is .
Remaining processes: {P1, P2}.
The safe sequence so far is .
Remaining processes: {P2}.
1.Calculate total allocated resources:
Total Allocation = Allocation(P1) + Allocation(P2) + Allocation(P3)Total Allocation = 3 + 1 + 3 = 7 tape drives.
2.Calculate available resources:
Total Resources = 9 tape drives.Available = Total Resources - Total Allocation
Available = 9 - 7 = 2 tape drives.
3.Calculate the 'Need' for each process:
Need = Maximum Requirement - Current Allocation- Need(P1) = 7 - 3 = 4
- Need(P2) = 6 - 1 = 5
- Need(P3) = 5 - 3 = 2
| Process | Allocation | Max | Need |
|---|---|---|---|
| P1 | 3 | 7 | 4 |
| P2 | 1 | 6 | 5 |
| P3 | 3 | 5 | 2 |
Available = 2
4.Run the Safety Algorithm:
We need to find a sequence of processes that can finish execution. A process can finish if its 'Need' is less than or equal to the 'Available' resources.- Initial State: Available = 2.
- Can P1 run? Need(P1) = 4. Is 4 ≤ 2? No.
- Can P2 run? Need(P2) = 5. Is 5 ≤ 2? No.
- Can P3 run? Need(P3) = 2. Is 2 ≤ 2? Yes.
- Execute P3: P3 runs to completion and releases its allocated resources.
The safe sequence so far is .
Remaining processes: {P1, P2}.
- Next State: Available = 5.
- Can P1 run? Need(P1) = 4. Is 4 ≤ 5? Yes.
- Execute P1: P1 runs to completion and releases its resources.
The safe sequence so far is .
Remaining processes: {P2}.
- Next State: Available = 8.
- Can P2 run? Need(P2) = 5. Is 5 ≤ 8? Yes.
- Execute P2: P2 runs to completion.
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Deadlocks
2026 Set 2 Q23Which one of the following CPU scheduling algorithms cannot be preemptive?2026 Set 1 Q29With respect to deadlocks in an operating system, which of the following statements is/are FALSE?2026 Set 1 Q31In the context of relational database normalization, which of the following statements is/are true?2026 Set 1 Q35Consider a system consisting of instances of a resource , being shared by 5 processes.…2026 Set 2 Q51Consider three processes P1, P2, and P3 running identical code, as shown in the pseudocode below. A…