GATE / CS ARCHIVE

GATE CSE 2020 / QUESTION 11

GATE CSE 2020 Q11

Operating Systems · Memory Allocation & Segmentation · Full GATE CSE 2020 paper

GATE 2020, Q11 1 mark · MCQ
Report issue

Memory Allocation & Segmentation

Question 11, GATE 2020: Allocate one process into a memory hole, with no exact fit. Which comparison of newly remaining holes is always true? A first-fit remainder > next-fit remainder; B worst-fit remainder > first-fit remainder; C best-fit remainder ≤ first-fit remainder; D next-fit remainder ≤ best-fit remainder.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Worked explanation

Let p be the process size and let H be the set of adequate hole sizes. Best fit chooses hB=min H. If first fit chooses hF∈H, then hB≤hF, and subtracting p gives hB−p≤hF−p. This is exactly C and allows equality. For counterexamples to strict claims A and B, take a single adequate hole: all policies choose it, so no remainder is strictly larger. D fails with adequate holes of sizes 10 and 20 for a process of size 6 when next fit chooses 20: its remainder 14 exceeds best fit’s 4. The cursor position matters for next fit, not for the minimum defining best fit.

Derivation and answer

Best fit chooses the smallest adequate hole. Subtracting the same process size from that hole and from the first-fit hole preserves the ≤ relation, so the best-fit remainder is never larger. Strict inequalities in the other options can fail when policies select the same hole. Thus C.

Original paper, page 6 · Answer key