Least Recently Used

What
Least recently used is a buffer replacement policy where the frame that was least recently used is chosen to be removed from the buffer

How

 * 1) Keep track of each page's last unpin time
 * 2) When time for choosing, pick the frame that has the lowest (earliest) time

Tip
ABCDAF. When we're trying to decide which buffer to replace to make room for F, we choose B because it is the closest to the front
 * When deciding which buffer page to replace, go backwards in the access order and see which one of the buffer pages is closest to the front

Advantages

 * Based on the idea of temporal locality, that is, if the page was requested recently, then it is more likely to be requested agian
 * Does well to keep "working sets" in memory

Disadvantages

 * LRU has a serious disadvantage when sequential scanning is involved because every page request will generate a buffer miss, which prompts expensive IO. This is especially apparent when the number of buffer pages is less than the size of the file that is being scanned.
 * "Cold" pages can hang around a long time before they are removed