GATE CS 2025 Set 1 — Question 54
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.NAT+2 / -0MediumPage Replacement AlgorithmsMemory ManagementOperating System
Operating System → Memory Management → Page Replacement Algorithms
Last updated
Question
In optimal page replacement algorithm, information about all future page references is available to the operating system (OS). A modification of the optimal page replacement algorithm is as follows:The OS correctly predicts only up to next 4 page references (including the current page) at the time of allocating a frame to a page.A process accesses the pages in the following order of page numbers:If the system has three memory frames that are initially empty, the number of page faults that will occur during execution of the process is ________ . (Answer in integer)
Correct answer
6 to 6
Solution
The modified optimal page replacement algorithm uses a look-ahead window of 4 page references (including the current one) to decide which page to replace when a page fault occurs and all frames are full. If a page fault occurs at time , the OS knows the references . It replaces the page in the frames that is either not in this window or appears furthest in the future within this window.Given page reference string:
Number of frames = 3 (initially empty)Trace:
Number of frames = 3 (initially empty)Trace:
1.Ref 1 (at ): Page fault. Frames: . Total faults = 1.
2.Ref 3 (at ): Page fault. Frames: . Total faults = 2.
3.Ref 2 (at ): Page fault. Frames: . Total faults = 3.
4.Ref 4 (at ): Page fault. Frames are full .
Look-ahead window (size 4 starting at current): .- Page is at (distance 1).
- Page is at (distance 2).
- Page is at (distance 3).
5.Ref 2 (at ): Hit. Frames: .
6.Ref 3 (at ): Hit. Frames: .
7.Ref 1 (at ): Page fault. Frames are full .
Look-ahead window: .- Page is at (distance 1).
- Page is at (distance 2).
- Page is at (distance 3).
8.Ref 2 (at ): Hit. Frames: .
9.Ref 4 (at ): Hit. Frames: .
10.Ref 3 (at ): Page fault. Frames are full .
Look-ahead window: . (Only 3 references remaining)- Page is at (distance 1).
- Page is at (distance 2).
- Page is not in the window.
11.Ref 1 (at ): Hit. Frames: .
12.Ref 4 (at ): Hit. Frames: .
Total number of page faults = 6.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…