GateAI
Memory Management and Virtual Memory

GATE CSE 2025 Set 2 · Q47

MSQ2 marksMedium

Time

Consider a demand paging system with three frames, and the following page reference string: 1 2 3 4 5 4 1 6 4 5 1 3 2. The contents of the frames are as follows initially and after each reference (from left to right): The *-marked references cause page replacements. Which one or more of the following could be the page replacement policy/policies in use?

GATE CSE 2025 Set 2 Q47 diagram

Select all that applyOne or more correct

Pick every correct option

Solution

Step-by-step verified solution

Official answer: D) Optimal page replacement policy

Memory Management and Virtual Memory

Let us trace the given reference string with 3 frames: 1 2 3 4 5 4 1 6 4 5 1 3 2 and verify each policy against the frame transitions given in the table:

  1. Optimal (OPT) Replacement Policy:

    • At reference 4 (Frame: {1,2,3}\{1, 2, 3\}): Future references are 5,4,1,6,4,5,1,3,25, 4, 1, 6, 4, 5, 1, 3, 2. Among {1,2,3}\{1, 2, 3\}, 11 is accessed at index 7, 33 at index 12, and 22 at index 13. Since 22 is needed furthest in the future, 22 is replaced by 44. Frame becomes {1,4,3}\{1, 4, 3\}.

    • At reference 5 (Frame: {1,4,3}\{1, 4, 3\}): Future references are 4,1,6,4,5,1,3,24, 1, 6, 4, 5, 1, 3, 2. Among {1,4,3}\{1, 4, 3\}, 44 is accessed next, 11 follows, and 33 is accessed at index 12. Thus, 33 is replaced by 55. Frame becomes {1,4,5}\{1, 4, 5\}.

    • References 4, 1: Hits. Frame remains {1,4,5}\{1, 4, 5\}.

    • At reference 6 (Frame: {1,4,5}\{1, 4, 5\}): Future references are 4,5,1,3,24, 5, 1, 3, 2. Among {1,4,5}\{1, 4, 5\}, 44 and 55 are accessed soon, while 11 is accessed at index 11. Thus, 11 is replaced by 66. Frame becomes {6,4,5}\{6, 4, 5\}.

    • References 4, 5: Hits. Frame remains {6,4,5}\{6, 4, 5\}.

    • At reference 1 (Frame: {6,4,5}\{6, 4, 5\}): Future references are 3,23, 2. None of 6,4,56, 4, 5 will be referenced again. Any of them can be replaced. Replacing 44 gives {6,1,5}\{6, 1, 5\}.

    • At reference 3 (Frame: {6,1,5}\{6, 1, 5\}): Neither 66 nor 55 is used again. Replacing 55 gives {6,1,3}\{6, 1, 3\}.

    • At reference 2 (Frame: {6,1,3}\{6, 1, 3\}): Neither 66 nor 33 is used again. Replacing 66 gives {2,1,3}\{2, 1, 3\}.

    All replacements perfectly match the table for Optimal Page Replacement. Hence, (D) is correct.

  2. Least Recently Used (LRU):

    • At reference 4, the past accesses are 1,2,31, 2, 3. The least recently used page is 11. But in the table, 22 is replaced. Hence, LRU cannot be in use.

  3. Least Frequently Used (LFU):

    • At reference 6, past accesses are 1,2,3,4,5,4,11, 2, 3, 4, 5, 4, 1. Frequency counts for pages in frames {1,4,5}\{1, 4, 5\} are: freq(1)=2\text{freq}(1) = 2, freq(4)=2\text{freq}(4) = 2, freq(5)=1\text{freq}(5) = 1. LFU would replace page 55. But the table replaces page 11. Hence, LFU cannot be in use.

  4. Most Frequently Used (MFU):

    • At reference 3 (step 12), past accesses are 1,2,3,4,5,4,1,6,4,5,11, 2, 3, 4, 5, 4, 1, 6, 4, 5, 1. Frequency counts for pages in frames {6,1,5}\{6, 1, 5\} are: freq(6)=1\text{freq}(6) = 1, freq(1)=3\text{freq}(1) = 3, freq(5)=2\text{freq}(5) = 2. MFU must replace page 11 (highest frequency). However, the table replaces page 55. Hence, MFU cannot be in use.

Therefore, only option (D) is correct.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Memory Management and Virtual Memory previous year question is Q47 of the GATE CSE 2025 Set 2 paper. Find more GATE CSE PYQs on Memory Management and Virtual Memory in Operating Systems, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Memory Management and Virtual Memory PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Memory Management and Virtual Memory in GATE CSE

Memory Management and Virtual Memory has 32 GATE CSE PYQs across 22 papers from 2011 to 2026. 2 of them are 2-mark MSQs like this one, and GATE CSE 2025 Set 2 has 2.

How GATE tests Memory Management and Virtual Memory

More from GATE CSE 2025 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2025 Set 2 · Q47 · MSQ

Consider a demand paging system with three frames, and the following page reference string: 1 2 3 4 5 4 1 6 4 5 1 3 2. The contents of the frames are as follows initially and after each reference (from left to right): The *-marked references cause page replacements. Which one or more of the following could be the page replacement policy/policies in use?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.