GATE CS 2026 Set 2 — Question 55
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.NAT+2 / -0MediumContiguous AllocationMemory ManagementOperating System
Operating System → Memory Management → Contiguous Allocation
Last updated
Question
Consider contiguous allocation of physical memory to processes using variable partitioning scheme. Suppose there are 8 holes in the memory of sizes 20 KB, 4 KB, 25 KB, 18 KB, 7 KB, 9 KB, 15 KB, and 12 KB. Assume that no two holes are adjacent. Two processes P1 of size 16 KB and P2 of size 9 KB arrive in that order, and they are allocated memory using the best-fit technique. After allocating space to P1 and P2, the number of holes of size less than 8 KB is ____________. (answer in integer)Note:
Correct answer
3 to 3
Solution
Initial holes (in KB): 20, 4, 25, 18, 7, 9, 15, 12.
After allocation, the remaining hole size is KB.
Updated holes: 20, 4, 25, 2, 7, 9, 15, 12.
After allocation, the remaining hole size is KB (the hole is completely filled).
Updated holes: 20, 4, 25, 2, 7, 15, 12.
Holes with size KB are: 4 KB, 2 KB, and 7 KB.
The number of such holes is 3.
1.Allocation of P1 (16 KB):
The best-fit algorithm searches for the smallest hole that is at least 16 KB. The candidates are 20, 25, and 18. The smallest is 18 KB.After allocation, the remaining hole size is KB.
Updated holes: 20, 4, 25, 2, 7, 9, 15, 12.
2.Allocation of P2 (9 KB):
The best-fit algorithm searches for the smallest hole that is at least 9 KB. The candidates are 20, 25, 9, 15, and 12. The smallest is 9 KB.After allocation, the remaining hole size is KB (the hole is completely filled).
Updated holes: 20, 4, 25, 2, 7, 15, 12.
3.Counting holes less than 8 KB:
The final list of holes is: 20, 4, 25, 2, 7, 15, 12.Holes with size KB are: 4 KB, 2 KB, and 7 KB.
The number of such holes is 3.
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 Memory Management
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…