GATE / CS ARCHIVE

GATE CSE 2007 / QUESTION 82

Optimal replacement page-fault count

Operating Systems · Virtual Memory & Paging · Full GATE CSE 2007 paper

GATE 2007, Q82 2 marks · MCQ
Report issue

Virtual Memory & Paging

Question 82, GATE 2007: A process has three initially empty page frames and reference string 1,2,1,3,7,4,5,6,3,1. How many page faults occur with optimal replacement?
Options:
(A) 7
(B) 8
(C) 9
(D) 10
Question 82, GATE 2007: A process has three initially empty page frames and reference string 1,2,1,3,7,4,5,6,3,1. How many page faults occur with optimal replacement?
Options:
(A) 7
(B) 8
(C) 9
(D) 10
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Step through it (12 steps)

1. Approach. At a miss with full frames, evict the page whose next reference lies farthest in the future, treating never-used-again pages as farthest. Keeping pages 1 and 3 is valuable because both are referenced at the end.

2. Derivation and interpretation. For references 1,2,1,3,7,4,5,6,3,1 with three initially empty frames, first load 1,2,3 (the second reference to 1 hits). When 7 arrives, discard 2 because it is never needed again. Retain 1 and 3 while replacing the third frame successively by 7,4,5,6; each of these pages has no future use. The final 3 and 1 then hit. Faults are on 1,2,3,7,4,5,6, totaling 7, option A. Seven distinct pages also give a matching lower bound.

Original paper, page 20