Skip to content
Official PYQ · 2026

GATE CS 2026 Set 2 Q45 — Memory Management and Virtual Memory

Explain with AI
Consider contiguous allocation of physical memory to processes using variable partitioning scheme. Suppose there are 88 holes in the memory of sizes 20KB,4 KB20 \mathrm{KB}, 4 \mathrm{~KB}, 25 KB,18 KB,7 KB,9 KB,15 KB25 \mathrm{~KB}, 18 \mathrm{~KB}, 7 \mathrm{~KB}, 9 \mathrm{~KB}, 15 \mathrm{~KB}, and 1212 KB. Assume that no two holes are adjacent. Two processes P1\text{P1} of size 1616 KB and P2\text{P2} of size 99 KB arrive in that order, and they are allocated memory using the best-fit technique. After allocating space to P1\text{P1} and P2\text{P2}, the number of holes of size less than 88 KB is _______\_\_\_\_\_\_\_. (answer in integer)

Note: 1K=2101 \mathrm{K}=2^{10}
View worked solution

Answer: 3:3

We are given the initial set of 8 memory holes of sizes:

{20 KB,4 KB,25 KB,18 KB,7 KB,9 KB,15 KB,12 KB}\{20\text{ KB}, 4\text{ KB}, 25\text{ KB}, 18\text{ KB}, 7\text{ KB}, 9\text{ KB}, 15\text{ KB}, 12\text{ KB}\}

Using the best-fit allocation strategy, we allocate memory to processes P1P_1 and P2P_2 in order:

  1. Allocation of P1P_1 (16 KB16\text{ KB}):
    The available holes of size ≥16 KB\ge 16\text{ KB} are 18 KB18\text{ KB}, 20 KB20\text{ KB}, and 25 KB25\text{ KB}. The best-fit (smallest sufficient) hole is 18 KB18\text{ KB}.
    After allocation, the remaining hole size is 18−16=2 KB18 - 16 = 2\text{ KB}.
    The updated set of holes is: {20 KB,4 KB,25 KB,2 KB,7 KB,9 KB,15 KB,12 KB}\{20\text{ KB}, 4\text{ KB}, 25\text{ KB}, 2\text{ KB}, 7\text{ KB}, 9\text{ KB}, 15\text{ KB}, 12\text{ KB}\}.
  2. Allocation of P2P_2 (9 KB9\text{ KB}):
    The available holes of size ≥9 KB\ge 9\text{ KB} are 9 KB9\text{ KB}, 12 KB12\text{ KB}, 15 KB15\text{ KB}, 20 KB20\text{ KB}, and 25 KB25\text{ KB}. The best-fit hole is exactly 9 KB9\text{ KB}.
    After allocation, no remaining hole is left from this block (9−9=0 KB9 - 9 = 0\text{ KB}).
    The final set of holes is: {20 KB,4 KB,25 KB,2 KB,7 KB,15 KB,12 KB}\{20\text{ KB}, 4\text{ KB}, 25\text{ KB}, 2\text{ KB}, 7\text{ KB}, 15\text{ KB}, 12\text{ KB}\}.

Now, we count the number of holes of size less than 8 KB8\text{ KB}:

  • 4 KB4\text{ KB} (Yes)
  • 2 KB2\text{ KB} (Yes)
  • 7 KB7\text{ KB} (Yes)

Thus, there are exactly 3 holes of size less than 8 KB8\text{ KB}.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Memory Management and Virtual Memory questions