Computer Sciences > GATE 2025 SET-2 > Page Replacement Algorithms
Consider a demand paging system with three frames, and the following page reference string: 123454164513 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?
A
Least Recently Used page replacement policy
B
Least Frequently Used page replacement policy
C
Most Frequently Used page replacement policy
D
Optimal page replacement policy

Correct : d

Simulating page references with 3 frames:
Frames start empty. First 3 references fill frames — all are compulsory misses.
Ref 1: frames = {1, -, -} → miss
Ref 2: frames = {1, 2, -} → miss
Ref 3: frames = {1, 2, 3} → miss
Ref 4*: frames full → replace. frames = {1, 2, 4} or {4, 2, 3} or {1, 4, 3} → miss
Ref 5*: frames full → replace → miss
Ref 4: hit
Ref 1: hit or miss depending on what was replaced
Ref 6*: replace → miss
Ref 4: hit
Ref 5: hit or miss
Ref 1: hit
Ref 3*: replace → miss
Ref 2: hit or miss
Checking Optimal page replacement:
Optimal replaces the page that will not be used for the longest time in the future.
After {1,2,3} filled:
Ref 4*: future = 5,4,1,6,4,5,1,3,2. Next use: 1→pos 7, 2→pos 13, 3→pos 12. Replace 2 (used latest). frames = {1,3,4}
Ref 5*: future = 4,1,6,4,5,1,3,2. Next use: 1→pos 6, 3→pos 11, 4→pos 3. Replace 3 (used latest). frames = {1,4,5}
Ref 4: hit. frames = {1,4,5}
Ref 1: hit. frames = {1,4,5}
Ref 6*: future = 4,5,1,3,2. Next use: 1→pos 5, 4→pos 1, 5→pos 2. Replace 1 (used latest at pos 5). frames = {6,4,5}
Ref 4: hit
Ref 5: hit
Ref 1*: future = 3,2. Next use: 6→never, 4→never, 5→never. Replace any (say 6). frames = {1,4,5}
Ref 3*: future = 2. Next use: 1→never, 4→never, 5→never. Replace any (say 4). frames = {1,3,5}
Ref 2: miss or hit depending on above choices
The page replacements (*) at positions 4, 5, 8, 11, 12 match the Optimal policy behavior.
Option A (LRU) — Does NOT match. LRU would make different replacement choices that don't align with the given frame trace.
Option B (LFU) — Does NOT match. LFU tracks frequency counts and would replace differently.
Option C (MFU) — Does NOT match. MFU replaces the most frequently used page — leads to different replacements.
Option D (Optimal) — Matches. The given replacement pattern is consistent with Optimal policy which always replaces the page used farthest in the future.
∴ The page replacement policy in use is Optimal page replacement policy (Option D)

Similar Questions

In optimal page replacement algorithm, information about all future page references is available to the operating system (OS). A modification of the optimal pag...
#1397 NAT
A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. From...
#1 MCQ
Which number does not belong in the series below? 2, 5, 10, 17, 26, 37, 50, 64
#4 MCQ

Related Topics

GATE 2025 GATE CS Set-2 Question 46 Page Replacement Algorithm LRU Least Recently Used LFU Least Frequently Used MFU Most Frequently Used Optimal Page Replacement Demand Paging Page Fault 3 Frames Page Reference String Frame Contents Operating Systems

Unique Visitor Count

Total Unique Visitors

Loading......