Similar questions 2 more →
Virtual Memory & Paging
![Question 21(a), GATE 1993: Four initially empty page frames receive [1, 2, 3, 4, 1, 3, 5, 2, 1, 5, 4, 3, 2, 3]. Identify each page fault under LRU.](../../assets/questions/CS-1993-Q58-1.webp)
![Question 21(a), GATE 1993: Four initially empty page frames receive [1, 2, 3, 4, 1, 3, 5, 2, 1, 5, 4, 3, 2, 3]. Identify each page fault under LRU.](../../assets/questions/CS-1993-Q58-2.webp)
![Question 21(a), GATE 1993: Four initially empty page frames receive [1, 2, 3, 4, 1, 3, 5, 2, 1, 5, 4, 3, 2, 3]. Identify each page fault under LRU.](../../assets/questions/CS-1993-Q58-3.webp)
Answer & solution
Answer: 9 faults, at reference positions 1,2,3,4,7,8,11,12,13. (no official key was published)
Step through it (16 steps)
The first four distinct references each fault and fill the four frames. On a later miss, evict the oldest entry in the policy order below. For LRU that means least recently used; for FIFO it means earliest loaded. LRU moves a referenced resident page to most-recent position even on a hit. Thus after references 5 and 6 the order is 2,4,1,3, and page 2 is evicted for page 5 at reference 7.
The full trace lists reference position, requested page, result, and policy order from eviction candidate to newest:
1: page 1, fault, order 1
2: page 2, fault, order 1,2
3: page 3, fault, order 1,2,3
4: page 4, fault, order 1,2,3,4
5: page 1, hit, order 2,3,4,1
6: page 3, hit, order 2,4,1,3
7: page 5, fault, order 4,1,3,5
8: page 2, fault, order 1,3,5,2
9: page 1, hit, order 3,5,2,1
10: page 5, hit, order 3,2,1,5
11: page 4, fault, order 2,1,5,4
12: page 3, fault, order 1,5,4,3
13: page 2, fault, order 5,4,3,2
14: page 3, hit, order 5,4,2,3
There are 9 faults. Positions are reported rather than only page values because the same page can fault more than once. Initially empty frames cause compulsory faults too; omitting them would undercount.