LRU Implementations
Counter implementation:
- Every page entry has a counter.
- Every time a page is referenced, increment a global counter and store it in the page counter.
- For page replacement, select the page with the lowest counter (search for it).
Stack implementation:
- Maintain a stack of page number in a double link list.
- Move a referenced page to the top (locate and change pointers).
- For page replacement, take the bottom page.
In any case:
- LRU is hard to implement as is. It requires too much work per page access or too much hardware support.