GATE / CS ARCHIVE

GATE CSE 2014 SET 3 / QUESTION 20

GATE CSE 2014 Set 3 Q20

Operating Systems · Virtual Memory & Paging · Full GATE CSE 2014 Set 3 paper

GATE 2014 Set 3, Q20 1 mark · NAT
Report issue

Virtual Memory & Paging

Question 20, GATE 2014: Three initially empty page frames use LRU replacement. Count faults for page references 4,7,6,1,7,6,1,2,7,2.
Tap to enlarge
Answer & solution

Official answer: 6

Step through it (12 steps)

Step 1: Maintain recency on hits as well as on insertions. Write resident pages from least to most recently used. The first three references fault and produce [4], [4,7], [4,7,6]. Step 2: Reference 1 faults and evicts 4, giving [7,6,1]. The following hits on 7,6,1 change the order to [6,1,7], [1,7,6], [7,6,1]. Step 3: Reference 2 faults, evicting 7 and giving [6,1,2]. Next 7 faults, evicting 6 and giving [1,2,7]. Final 2 hits and gives [1,7,2]. Faults occur at positions 1,2,3,4,8,9: total 6.

Original paper, page 57 · Answer key