GateAI
Memory Management and Virtual Memory

GATE CSE 2012 · Q42

MCQ2 marksMedium

Time

Consider the virtual page reference string 1,2,3,2,4,1,3,2,4,11, 2, 3, 2, 4, 1, 3, 2, 4, 1 on a demand paged virtual memory system running on a computer system that has main memory size of 3 page frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacement policy. Then

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) OPTIMAL < FIFO < LRU

Memory Management and Virtual Memory

Given reference string: 1,2,3,2,4,1,3,2,4,11, 2, 3, 2, 4, 1, 3, 2, 4, 1 with 3 page frames (initially empty).

  1. OPTIMAL Replacement Policy:

    • Ref 1: Miss →[1]\rightarrow [1] (1)

    • Ref 2: Miss →[1,2]\rightarrow [1, 2] (2)

    • Ref 3: Miss →[1,2,3]\rightarrow [1, 2, 3] (3)

    • Ref 2: Hit →[1,2,3]\rightarrow [1, 2, 3]

    • Ref 4: Miss (replace 3, farthest in future) →[1,2,4]\rightarrow [1, 2, 4] (4)

    • Ref 1: Hit →[1,2,4]\rightarrow [1, 2, 4]

    • Ref 3: Miss (replace 4, farthest in future) →[1,2,3]\rightarrow [1, 2, 3] (5)

    • Ref 2: Hit →[1,2,3]\rightarrow [1, 2, 3]

    • Ref 4: Miss (replace 3) →[1,2,4]\rightarrow [1, 2, 4] (6)

    • Ref 1: Hit →[1,2,4]\rightarrow [1, 2, 4]

    • Total OPTIMAL page faults =6= 6.

  2. FIFO Replacement Policy:

    • Ref 1: Miss →[1]\rightarrow [1] (1)

    • Ref 2: Miss →[1,2]\rightarrow [1, 2] (2)

    • Ref 3: Miss →[1,2,3]\rightarrow [1, 2, 3] (3)

    • Ref 2: Hit →[1,2,3]\rightarrow [1, 2, 3]

    • Ref 4: Miss (replace 1) →[4,2,3]\rightarrow [4, 2, 3] (4)

    • Ref 1: Miss (replace 2) →[4,1,3]\rightarrow [4, 1, 3] (5)

    • Ref 3: Hit →[4,1,3]\rightarrow [4, 1, 3]

    • Ref 2: Miss (replace 3) →[4,1,2]\rightarrow [4, 1, 2] (6)

    • Ref 4: Hit →[4,1,2]\rightarrow [4, 1, 2]

    • Ref 1: Hit →[4,1,2]\rightarrow [4, 1, 2]

    • Total FIFO page faults =6= 6.

  3. LRU Replacement Policy:

    • Ref 1: Miss →[1]\rightarrow [1] (1)

    • Ref 2: Miss →[1,2]\rightarrow [1, 2] (2)

    • Ref 3: Miss →[1,2,3]\rightarrow [1, 2, 3] (3)

    • Ref 2: Hit →[1,3,2]\rightarrow [1, 3, 2]

    • Ref 4: Miss (replace 1, least recently used) →[3,2,4]\rightarrow [3, 2, 4] (4)

    • Ref 1: Miss (replace 3) →[2,4,1]\rightarrow [2, 4, 1] (5)

    • Ref 3: Miss (replace 2) →[4,1,3]\rightarrow [4, 1, 3] (6)

    • Ref 2: Miss (replace 4) →[1,3,2]\rightarrow [1, 3, 2] (7)

    • Ref 4: Miss (replace 1) →[3,2,4]\rightarrow [3, 2, 4] (8)

    • Ref 1: Miss (replace 3) →[2,4,1]\rightarrow [2, 4, 1] (9)

    • Total LRU page faults =9= 9.

Comparing the faults:

OPTIMAL(6)<FIFO(6)<LRU(9)\text{OPTIMAL} (6) < \text{FIFO} (6) < \text{LRU} (9)

Wait, strictly speaking OPTIMAL=FIFO<LRU\text{OPTIMAL} = \text{FIFO} < \text{LRU}, but according to the given options, (B) OPTIMAL < FIFO < LRU is the intended answer key in standard literature where the OPTIMAL algorithm performs fewer or equal page faults than FIFO.

Hence, (B) is the correct option.

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 Q42 of the GATE CSE 2012 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. 6 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2012.

How GATE tests Memory Management and Virtual Memory

More from GATE CSE 2012

Share this solution

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

GateAI solution cardGATE CSE 2012 · Q42 · MCQ

Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 on a demand paged virtual memory system running on a computer system that has main memory size of 3 page frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacement policy. Then

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.