What this topic covers
11 subtopics- Demand paging7
- FIFO7
- LRU6
- Performance5
- Linux4
- Clock3
- Comparison3
- Thrashing3
- Working set3
- Frame allocation2
- Optimal2
- Beginner 15
- Intermediate 15
- Advanced 15
About this topic
Page-replacement numericals are GATE and placement favourites: given a reference string and a number of frames, count the page faults for FIFO, LRU and Optimal. Reference strings are drawn here, and some questions show the frames over time as a table. Frames start empty, every first load counts as a fault, and every count was produced by running the algorithm.
Free preview
Sample questions
Try each one first, then open the answer for the explanation and why the other options are wrong.
With 3 frames, initially empty, how many page faults does FIFO cause for this reference string?
- 7
- 0
- 1
- 2
- 0
- 3
- 0
- 4
- 2
- 3
- 0
- 3
- 2
- 1
- 2
- 0
- 1
- 7
- 0
- 1
The answer is a number – work it out, then open the solution.
Show answer and explanation
Explanation
15 faults and only 5 hits. FIFO evicts the page that was loaded earliest, however recently it was used – so it keeps throwing out page 0, which this string uses again and again.
FIFO on this string with 3 frames and with 4 frames. How many faults in each case?
- 1
- 2
- 3
- 4
- 1
- 2
- 5
- 1
- 2
- 3
- 4
- 5
Show answer and explanation
Explanation
This is the classic string demonstrating Belady's anomaly: the extra frame makes FIFO fault once more. LRU on the same string gives 10 and 8.
Why the other options are wrong
- AThat would be normal behaviour.
- CThere are hits.
- DSwapped.
With 3 frames, how many faults do FIFO, LRU and Optimal cause on this string?
- 1
- 2
- 3
- 4
- 2
- 1
- 5
- 6
- 2
- 1
- 2
- 3
- 7
- 6
- 3
- 2
- 1
- 2
- 3
- 6
Show answer and explanation
Explanation
With 4 frames the counts drop to 14, 10 and 8. LRU is only slightly better than FIFO here because the string jumps between localities.
Why the other options are wrong
- ALRU beats FIFO here.
- BThose are the classic string's counts.
- CThose are with 4 frames.