> For the complete documentation index, see [llms.txt](https://til.notdu.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.notdu.com/database/intro-to-database-systems/buffer-pool-and-memory-management/clock.md).

# Clock

Approximation of LRU without needing a separate timestamp per page.

* Each page has a reference bit
* When a page is accessed, set to 1.

Organize the pages in a circular buffer with a "clock hand":

* Upon sweeping, check if a page's bit is set to 1
* If yes, set to zero. If no, then evict
