- 2070 Bhadra · 2+6 marks
Hits and faults: FIFO, LRU, Optimal
Short answer
With 3 frames, FIFO yields 8 page faults and 2 hits; LRU yields 8 faults and 2 hits; Optimal yields 7 faults and 3 hits.
Calculate Hit and Faults using various page replacement algorithm policies (FIFO, LRU, Optimal) for the following page sequence (The page frame size is 3). 2 3 5 4 2 5 7 3 8 7
Reference string: 2 3 5 4 2 5 7 3 8 7 (10 references), 3 frames, initially empty. * marks a fault (miss); blank is a hit.
FIFO (replace the oldest page)
ref 2 3 5 4 2 5 7 3 8 7
F1 2 2 2 4 4 4 4 3 3 3
F2 - 3 3 3 2 2 2 2 8 8
F3 - - 5 5 5 5 7 7 7 7
* * * * * * * *
Faults = 8, hits = 2 (the second 5 and the second 7).
LRU (replace the least recently used page)
ref 2 3 5 4 2 5 7 3 8 7
F1 2 2 2 4 4 4 7 7 7 7
F2 - 3 3 3 2 2 2 3 3 3
F3 - - 5 5 5 5 5 5 8 8
* * * * * * * *
Faults = 8, hits = 2.
Optimal (replace the page not needed for the longest time)
ref 2 3 5 4 2 5 7 3 8 7
F1 2 2 2 2 2 2 7 7 7 7
F2 - 3 3 4 4 4 4 3 8 8
F3 - - 5 5 5 5 5 5 5 5
* * * * * * *
Faults = 7, hits = 3 (2, 5 and the final 7). At the reference 7 (position 7), the pages 2, 4 and 5 are in memory and none of them is used again, so any of them may be replaced (2 is taken here).
Summary
| Algorithm | Page faults | Hits | Hit ratio |
|---|---|---|---|
| FIFO | 8 | 2 | 20% |
| LRU | 8 | 2 | 20% |
| Optimal | 7 | 3 | 30% |
Answer: FIFO 8 faults/2 hits, LRU 8 faults/2 hits, Optimal 7 faults/3 hits.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Page faults: FIFO, Optimal, LFU, LRU · Operating System, chapter 4 · asked 2×
- Page faults with 3 frames: LRU, FIFO, OPT · Operating System, chapter 4 · asked 2×
- Page faults: LRU, FIFO, Optimum · Operating System, chapter 4
- LRU algorithm; page faults on string · Operating System, chapter 4
- Race condition; optimal page replacement limits · Operating System, chapter 3
- Thrashing; page faults on 3 frames · Operating System, chapter 4
- LRU replacement with hit and miss · Computer Organization and Architecture, chapter 6
- Cache replacement policies · Embedded System, chapter 4