Page Replacement and the Clock Algorithm

Approximate recency using a reference bit and work through the search for a reclaimable frame.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Give a recently referenced page a second chance
  2. Replacement queries the recent past only approximately

Give a recently referenced page a second chance

A clock replacement policy keeps a circular sequence of candidate frames. At each candidate, inspect its reference bit. If set, clear it and advance. If clear, it can be selected, subject to eligibility and dirty-page handling. If the current sequence of bits is \(1,1,0\), a pass clears the first two and selects the third. The hand’s position influences later choices.

Replacement queries the recent past only approximately

Accesses can set bits again between scans. The policy therefore estimates recency without keeping a complete order of individual accesses. A dirty victim can require writeback, making cost depend on more than recency. Working sets explain why repeated replacement grows expensive when frequently used pages cannot fit. Demand paging explains the later cost of returning a missing page.[1]

References

  1. Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces ↩