Page Replacement Algorithms

Clock Policy

This policy sounds hard., but really it’s relatively simple. See Page Replacement Algorithms for an example.

Clock Policy … approximates LRU

  • Additional bit called a use bit
  • When a page is first loaded in memory, the use bit is set to 1 (pointer moves down)
  • When the page is referenced, the use bit is set to 1 (pointer doesn’t move)
  • When it is time to replace a page, the first frame encountered with the use bit set to 0 is replaced
    • During the search for replacement, each use bit set to 1 is changed to 0

Where is the pointer? Do we always start from the beginning during the search?

No. When a page is replaced, the pointer is set to indicate the next frame in the buffer after the one just updated.