GATE / CS ARCHIVE

GATE CSE 2025 SET 2 / QUESTION 47

GATE CSE 2025 Set 2 Q47

Operating Systems · Virtual Memory & Paging · Full GATE CSE 2025 Set 2 paper

GATE 2025 Set 2, Q47 2 marks · MSQ
Report issue

Virtual Memory & Paging

Question 47, GATE 2025: A demand-paging system has three initially empty frames and reference string [1,2,3,4,5,4,1,6,4,5,1,3,2]. In frame order, the resident triples after each reference are:
1:(1,−,−); 2:(1,2,−); 3:(1,2,3); 4:(1,4,3); 5:(1,4,5); 6:(1,4,5); 7:(1,4,5); 8:(6,4,5); 9:(6,4,5); 10:(6,4,5); 11:(6,1,5); 12:(6,1,3); 13:(2,1,3).
Which policies could produce this trace? A. LRU; B. LFU; C. MFU; D. optimal/farthest-next-use. Frequency-counter lifetime and tie-breaking are not stated.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: D

Our answer: D with lifetime counters; C;D with reset-on-load counters

Test policies at the first point where their required choice disagrees with the trace. LRU fails at reference 4: among pages 1,2,3, page 1 was used least recently, but the trace evicts page 2. LFU fails at reference 8: before loading page 6, resident reference counts are page 1:2, page 4:2, page 5:1. The trace evicts page 1 rather than the least frequent page 5. These counts agree under both lifetime and reset-on-load conventions at that point.

Optimal replacement is possible. At reference 4, pages 1,2,3 are next used at positions 7,13,12, so evict 2. At reference 5, residents 1,4,3 are next used at 7,6,12, so evict 3. At reference 8, residents 1,4,5 are next used at 11,9,10, so evict 1. At references 11,12,13, the displayed victim is never used again, so the trace can choose it among tied infinite-next-use victims. Thus D is valid.

MFU requires a convention. With lifetime counts, reference 11 loads page 1 with its cumulative count now 3. At reference 12, residents have counts 6:1,1:3,5:2, but the trace evicts 5, not 1. So lifetime MFU fails already there; the final eviction also contradicts it.

With counts reset on each page load, however, MFU can reproduce the whole trace: early victims 2 and 3 are tied at 1; at reference 8 choose page 1 tied with 4 at 2; at reference 11 evict 4 at 3; at reference 12 evict 5 at 2; at reference 13 all residents have count 1 and 6 may be evicted. Therefore C,D are possible under this interpretation. Preserve official answer D and discrepancy CS-2025-S2-Q47-MFU-COUNTERS. The ambiguity is about unspecified counters, not an error in the displayed trace.

Original paper, page 36 · Answer key