The GATE Grind

GATE 2026 CS (CS2) – Question 55

Operating System · Memory Management and Virtual Memory · 2 marks · Numerical answer

Consider contiguous allocation of physical memory to processes using variable partitioning. There are 8 holes of sizes 20 KB, 4 KB, 25 KB, 18 KB, 7 KB, 9 KB, 15 KB, and 12 KB, and no two holes are adjacent. Two processes $P_1$ of size 16 KB and $P_2$ of size 9 KB arrive in that order and are allocated memory using best fit. After allocating space to $P_1$ and $P_2$, the number of holes of size less than 8 KB is __________. (answer in integer)

Note: $1\text{ K}=2^{10}$.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 3

Explanation

Best fit allocates $P_1$ of size 16 KB to the 18 KB hole, leaving a 2 KB hole. Then $P_2$ of size 9 KB is allocated exactly into the 9 KB hole, leaving no remainder there. The original holes smaller than 8 KB were 4 KB and 7 KB, and the new 2 KB hole is also smaller than 8 KB. Therefore, the final number of holes of size less than 8 KB is 3.