Skip to content
Official PYQ · 2014

GATE CS 2014 Set 1 Q33 — Memory Management and Virtual Memory

Explain with AI
Assume that there are 33 page frames which are initially empty. If the page reference string is 1, 2, 3, 4, 2, 1, 5, 3, 2, 4, 6\text{1, 2, 3, 4, 2, 1, 5, 3, 2, 4, 6} the number of page faults using the optimal replacement policy is__________.
View worked solution

Answer: 7

Under the Optimal Page Replacement policy, we replace the page that will not be used for the longest period of time in the future. We have 33 initially empty frames.

The step-by-step trace of the page reference string is shown below:

Ref Frame 1 Frame 2 Frame 3 Result Reason / Replacement
11--Page Fault (1)Initially empty
212-Page Fault (2)Initially empty
3123Page Fault (3)Initially empty
4124Page Fault (4)Replace 3 (used furthest in future at step 8)
2124HitPage 2 already present
1124HitPage 1 already present
5524Page Fault (5)Replace 1 (not used in future)
3324Page Fault (6)Replace 5 (not used in future)
2324HitPage 2 already present
4324HitPage 4 already present
6624Page Fault (7)Replace any (e.g., 3)

Thus, the total number of page faults is 7.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Memory Management and Virtual Memory questions