Clock
Clock is an approximation of LRU that doesn’t keep the exact order of which page was last accessed, making Clock implementations faster than exact LRU.
Colors
Ref
Unref
- A blue square is a page marked as referenced
- A red square is a page marked as not referenced (“Unref”)
Layouts
Clock has three layouts.
- Circle arranges the pages in a circle, resembling a real life clock. When starting fresh, the first page is positioned at the top, and the following pages are inserted clockwise. A pointer in the center of the pages represents the clock hand and points to the same page.
- Flat arranges the pages linearly. When the hand reaches the end of the pages, it wraps around to the start. The app will automatically use this layout when creating a clock algorithm with high capacity.
- Flat (fast) is the same as the Flat layout but the animation of the clock hand visiting each referenced page and marking them unreferenced is omitted, speeding up the animation.
Implementation
This website implements Clock as described in F. J. Corbato., 1968, with k = 1 and without the first-time bit mechanism.
Cases
PageRVis recognizes 5 cases of the algorithm behavior in the “last event” section.
- Hit
- Miss with available capacity
- Miss with all pages referenced
- Miss with hand pointing to unreferenced page
- Miss with hand pointing to referenced page