Skip to main content

GATE CSE 2026Operating System › Memory Management & Virtual MemoryVerified

GATE CSE 2026 PYQ: Consider contiguous allocation of physical memory to processes using variable partitioning scheme. Suppose…

Consider contiguous allocation of physical memory to processes using variable partitioning scheme. Suppose there are 8 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 12 KB. Assume that no two holes are adjacent. Two processes P1\text{P1} of size 16 KB and P2\text{P2} of size 9 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 8 KB is _______\_\_\_\_\_\_\_. (answer in integer)

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

    Answer

    3

    Approach

    Under variable partitioning, best-fit chooses the smallest available hole that can hold the process; any leftover becomes a new smaller hole. Allocate P1 first, then P2 in arrival order, and count remaining holes smaller than 8 KB.

    Best-fit allocates P1 to the 18 KB hole, leaving 2 KB, and allocates P2 to the 9 KB hole exactly. The remaining holes below 8 KB are 4, 2, and 7 KB, so the answer is 3.

    Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.