Skip to content
Official PYQ · 2007

GATE CS 2007 Q82 — Memory Management and Virtual Memory

Explain with AI

A process has been allocated 33 page frames. Assume that none of the pages of the process are available in the memory initially. The process makes the following sequence of page references (reference string): 1,2,1,3,7,4,5,6,3,1\mathbf{1, 2, 1, 3, 7, 4, 5, 6, 3, 1}

If optimal page replacement policy is used, how many page faults occur for the above reference string?

Choose one option
View worked solution

Answer: A

The Optimal Page Replacement algorithm replaces the page that will not be used for the longest period of time in the future.

We are given 33 empty page frames. Let's trace the execution step-by-step for the reference string: 1,2,1,3,7,4,5,6,3,11, 2, 1, 3, 7, 4, 5, 6, 3, 1.

Ref Frame 1 Frame 2 Frame 3 Fault? Reason / Action
1 1 - - Yes (1) Initial allocation
2 1 2 - Yes (2) Initial allocation
1 1 2 - No Page 1 is already in memory (Hit)
3 1 2 3 Yes (3) Initial allocation
7 1 7 3 Yes (4) Replace 2 (never referenced again)
4 1 4 3 Yes (5) Replace 7 (never referenced again)
5 1 5 3 Yes (6) Replace 4 (never referenced again)
6 1 6 3 Yes (7) Replace 5 (never referenced again)
3 1 6 3 No Page 3 is already in memory (Hit)
1 1 6 3 No Page 1 is already in memory (Hit)

Thus, the total number of page faults is 77.

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

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