GATE CS 2025 Set 2 — Question 47
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MSQ+2 / -0MediumPage Replacement AlgorithmsMemory ManagementOperating System
Operating System → Memory Management → Page Replacement Algorithms
Last updated
Question
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?
| initially | 1* | 2* | 3* | 4* | 5* | 4 | 1 | 6* | 4 | 5 | 1* | 3* | 2* |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| - | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 6 | 6 | 6 | 6 | 6 | 2 |
| - | - | 2 | 2 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 1 | 1 | 1 |
| - | - | - | 3 | 3 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 3 | 3 |
Correct answer
(D) Optimal page replacement policy
Solution
We analyze the page replacements to determine the policy:Reference String: 1, 2, 3, 4, 5, 4, 1, 6, 4, 5, 1, 3, 2
Frames: 3
Frames: 3
1.Ref 4 (Fault): Current frames . Replaces 2. New frames .
- LRU: History is 3, 2, 1. LRU is 1. Replaced 2. Not LRU.
- Optimal: Future refs: 5, 4, 1, 6, 4, 5, 1, 3, 2. Next uses: 1 (soon), 3 (far), 2 (farthest). Optimal replaces 2. Matches.
- Optimal: Future refs: 4, 1, 6... Next uses: 4 (soon), 1 (soon), 3 (far). Optimal replaces 3. Matches.
- LFU: Counts in memory: 1 (2 refs), 4 (2 refs), 5 (1 ref). LFU is 5. Replaced 1. Not LFU.
- Optimal: Future refs: 4, 5, 1... Next uses: 4 (soon), 5 (soon), 1 (far). Optimal replaces 1. Matches.
- Optimal: Future refs: 3, 2. Pages 6, 4, 5 are never used again. Tie-breaking (e.g., FIFO on 'never used') replaces 4. Matches.
- MFU: Counts (accumulated): 1 (3 refs), 5 (2 refs), 6 (1 ref). MFU is 1. Replaced 5. Not MFU.
- Optimal: Future ref: 2. Pages 6, 1, 5 never used. Tie-breaking replaces 5. Matches.
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Memory Management
2026 Set 2 Q23Which one of the following CPU scheduling algorithms cannot be preemptive?2026 Set 1 Q29With respect to deadlocks in an operating system, which of the following statements is/are FALSE?2026 Set 1 Q31In the context of relational database normalization, which of the following statements is/are true?2026 Set 1 Q35Consider a system consisting of instances of a resource , being shared by 5 processes.…2026 Set 2 Q51Consider three processes P1, P2, and P3 running identical code, as shown in the pseudocode below. A…