GATE / CS ARCHIVE

GATE CSE 2026 SET 2 / QUESTION 55

Best-fit allocations and remaining holes

Operating Systems · Memory Allocation & Segmentation · Full GATE CSE 2026 Set 2 paper

GATE 2026 Set 2, Q55 2 marks · NAT
Report issue

Memory Allocation & Segmentation

Question 55, GATE 2026: Nonadjacent free holes have sizes 20,4,25,18,7,9,15,12 KB. Allocate a 16 KB process and then a 9 KB process by best fit. How many remaining holes are smaller than 8 KB?
Tap to enlarge
Answer & solution

Official answer: 3

Givens and goal

Nonadjacent free holes have sizes 20,4,25,18,7,9,15,12 KB. Allocate a 16 KB process and then a 9 KB process by best fit. How many remaining holes are smaller than 8 KB?

Approach

At each arrival choose the smallest currently adequate hole, then update the list.

Step-by-step solution

1. For the 16 KB request the adequate holes are 18,20,25 KB. Best fit chooses 18 KB, leaving an 18−16=2 KB fragment. The 15 KB and smaller holes cannot accommodate it.
2. Afterward the hole sizes are 20,4,25,2,7,9,15,12 KB. For the 9 KB request, the 9 KB hole is an exact fit and is removed entirely; it does not remain as a zero-size hole.
3. The final positive hole sizes are 20,4,25,2,7,15,12 KB. Those strictly less than 8 KB are 4,2,7 KB, giving three holes.
4. No coalescing is performed because the original holes are nonadjacent and these operations only split or consume them. The answer is 3. Always recompute the available holes after the first allocation rather than assigning both requests independently to the original list.

Original paper, page 39 · Answer key