Operating Systems
Page replacement
Which page to push out when no frame is free.
In two minutes
One idea to a line
FIFO evicts the page that has been in memory longest. LRU evicts the page unused for the longest time. Optimal evicts the page not needed for the longest time ahead.
Optimal gives the fewest faults but needs the future, so it is the yardstick, not a real algorithm.
Belady's anomaly: with FIFO, more frames can give more faults. LRU and Optimal are stack algorithms and never do this.
Clock (second chance) approximates LRU: a hand sweeps the frames, clearing use bits, and evicts the first page whose bit is 0.
Filling an empty frame still counts as a page fault.
Slips people make here
Interviewers know them too
Not counting the first faults that fill empty frames.
Mixing up "least recently used" with "least frequently used".
Expecting FIFO to improve whenever frames are added.
Your practice here
Not started
10 written questions, and 3 kinds of calculation that change every time
No answers yet