GATE / CS ARCHIVE

GATE CSE 2022 / QUESTION 64

GATE CSE 2022 Q64

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

GATE 2022, Q64 2 marks · NAT
Report issue

Virtual Memory & Paging

Question 64, GATE 2022: Four initially empty demand-paging frames use LRU. References: 7,2,7,3,2,5,3,4,6,7,7,1,5,6,1. Find page faults/accesses rounded to one decimal.
Tap to enlarge
Answer & solution

Official answer: 0.6

Step through it (17 steps)

Simulating four LRU frames gives faults at reference positions 1, 2, 4, 6, 8, 9, 10, 12, 13, for the values 7, 2, 3, 5, 4, 6, 7, 1, 5. The other six references hit. In particular, the second consecutive 7 hits, and the last 6 and 1 both remain resident. Hence the fault rate is 9/15=0.6.

Maintain recency oldest→newest after each access: [7]; [7,2]; [2,7]; [2,7,3]; [7,3,2]; [7,3,2,5]; [7,2,5,3]; [2,5,3,4]; [5,3,4,6]; [3,4,6,7]; [3,4,6,7]; [4,6,7,1]; [6,7,1,5]; [7,1,5,6]; [7,5,6,1]. On a full-frame miss remove the oldest before appending; on a hit move the referenced page to newest.

Original paper, page 40 · Answer key