Skip to main content

GATE CSE 2025Operating System › Memory Management & Virtual MemoryVerified

GATE CSE 2025 PYQ: In optimal page replacement algorithm, information about all future page references is available to the…

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:
1,3,2,4,2,3,1,2,4,3,1,41,3,2,4,2,3,1,2,4,3,1,4
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)

    Answer

    6

    Approach

    Simulate the optimal page replacement algorithm with a limited look-ahead window of four references (including the current reference). At each page fault, evict the page in memory whose next use is farthest within the window; if a page is not referenced in the window, evict it.

    The modified optimal algorithm with a look-ahead window of four references produces the same number of faults as full optimal replacement for this sequence: 6.

    Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.