GATE CS 2025 Set 1 | Question 54

Operating Systems › Memory Management · NAT · 2 marks · Answer: 6

  1. Question 54Operating Systemsnat2 marks
    In optimal page replacement, all future references are known. A modification: the OS correctly predicts only the next 4 page references (including the current one) at the time of allocating a frame. A process accesses pages in order:
    With three frames initially empty, the number of page faults during execution is ________. (Answer in integer)

    Answer: 6

    Solution

    Answer: 6 Three frames, evict the page whose next use within the 4-reference window is farthest (or not used in the window):
    ref | frames after | fault? (eviction)
     1  | 1            | fault
     3  | 1 3          | fault
     2  | 1 3 2        | fault
     4  | 3 2 4        | fault  (window 4,2,3,1: 1 used farthest -> evict 1)
     2  | 3 2 4        | hit
     3  | 3 2 4        | hit
     1  | 2 4 1        | fault  (window 1,2,4,3: 3 farthest -> evict 3)
     2  | 2 4 1        | hit
     4  | 2 4 1        | hit
     3  | 4 1 3        | fault  (window 3,1,4: 2 not used -> evict 2)
     1  | 4 1 3        | hit
     4  | 4 1 3        | hit
    Total page faults .

More GATE PYQ on Memory Management

All GATE CS Operating Systems PYQ →

Attempt GATE CS 2025 Set 1 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →