GATE CS 2018 Set 1 — Question 49
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MCQ+2 / -0.67MediumBanker's AlgorithmDeadlocksOperating System
Operating System → Deadlocks → Banker's Algorithm
Last updated
Question
In a system, there are three types of resources: and . Four processes and execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max as given below. For example, Max[] is the maximum number of instances of that would require. The number of instances of the resources allocated to the various processes at any given state is given by a matrix named Allocation.Consider a state of the system with the Allocation matrix as shown below, and in which 3 instances of and 3 instances of are the only resources available.
From the perspective of deadlock avoidance, which one of the following is true?
| Allocation | Max | |||||
|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 4 | 3 | 1 | |
| 1 | 1 | 2 | 2 | 1 | 4 | |
| 1 | 0 | 3 | 1 | 3 | 3 | |
| 2 | 0 | 0 | 5 | 4 | 1 |
Correct answer
(A) The system is in safe state.
Solution
To determine if the system is in a safe state, we use the Banker's Algorithm. We first calculate the Need matrix using the formula:Given:
Available Resources: (since only E and F are mentioned as available).
Vector Allocation Matrix:
Max Matrix:
Need Matrix Calculation:
Safety Algorithm:
Current Available:
New Available = Current Available + Allocation()
New Available =
Process finishes.
New Available =
Process finishes.
New Available =
Process finishes.
New Available =
Process finishes.Since a safe sequence exists, the system is in a safe state.
Available Resources: (since only E and F are mentioned as available).
Vector Allocation Matrix:
Max Matrix:
Need Matrix Calculation:
Safety Algorithm:
Current Available:
1.Check if any process can be satisfied ():
- Need True
- Need False (Need G=2 > Avail G=0)
- Need True
- Need False (Need F=4 > Avail F=3)
New Available = Current Available + Allocation()
New Available =
Process finishes.
2.Current Available:
Remaining Processes: - Need False (Need G=2 > Avail G=1)
- Need True
- Need False (Need F=4 > Avail F=3)
New Available =
Process finishes.
3.Current Available:
Remaining Processes: - Need True
- Need False (Need F=4 > Avail F=3)
New Available =
Process finishes.
4.Current Available:
Remaining Processes: - Need True
New Available =
Process finishes.Since a safe sequence exists, the system is in a safe state.
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…