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
Check each replacement (the first three references only fill empty frames).
(A) LRU - not possible. At the reference to 4, the least recently used page among is 1, but 2 was evicted.(B) LFU - not possible. At the reference to 6, pages 1 and 4 have each been referenced twice and page 5 once, so LFU must evict 5, but 1 was evicted.(D) Optimal - possible. At every fault the evicted page is one whose next use is farthest away (or never):
| Ref | Frames before | Evicted |
|---|---|---|
| 4 | 1, 2, 3 | 2 |
| 5 | 1, 4, 3 | 3 |
| 6 | 1, 4, 5 | 1 |
| 1 | 6, 4, 5 | 4 |
| 3 | 6, 1, 5 | 5 |
| 2 | 6, 1, 3 | 6 |
- ref 4: next uses of 1, 3, 2 are at positions 7, 12, 13; evict 2.
- ref 5: next uses of 1, 4, 3 are 7, 6, 12; evict 3.
- ref 6: next uses of 1, 4, 5 are 11, 9, 10; evict 1.
- ref 1, ref 3, ref 2: the remaining pages that are evicted are never used again (ties).
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…