GATE / CS ARCHIVE

GATE CSE 2007 / QUESTION 83

Extra faults from LRU replacement

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

GATE 2007, Q83 2 marks · MCQ
Report issue

Virtual Memory & Paging

Question 83, 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 more faults does LRU incur than optimal replacement?
Options:
(A) 0
(B) 1
(C) 2
(D) 3
Question 83, 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 more faults does LRU incur than optimal replacement?
Options:
(A) 0
(B) 1
(C) 2
(D) 3
Question 83, 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 more faults does LRU incur than optimal replacement?
Options:
(A) 0
(B) 1
(C) 2
(D) 3
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Step through it (2 policies)

1. Approach. LRU uses past recency rather than future references. Maintain a least-recent-to-most-recent list and move a page to the end even on a hit; then compare the full LRU count with the optimal count.

2. Derivation and interpretation. LRU faults on references 1,2,3,7,4,5,6,3,1; only the early repeated 1 hits. After loading 3, the least-recent order is 2,1,3; successive new pages evict 2, then 1, then 3, then 7. Therefore final references 3 and 1 also fault. LRU has 9 faults versus the optimal 7, an excess of 2, option C.

Original paper, page 20