Difference between revisions of "Least Recently Used algorithm"

From Computer History Wiki
Jump to: navigation, search
(A bit stubby, but not too bad)
 
m (Jnc moved page LRU to Least Recently Used replacement algorithm: Full name)
(No difference)

Revision as of 17:58, 14 November 2023

The Least Recently Used replacement algorithm (usually abbreviated as LRU) is an algorithm for choosing which entry to 'recycle' first in an array of resources, when a need arises for a free resource, and they are already all in use. It says, as the name implies, that one should recycle the entry which was last used the longest time ago, since the others are more likely to be used again soon.

The reasoning is that freeing a resource likely involves some effort (e.g. writing a modified disk block from a buffer back onto secondary storage), so that effort should be expended are rarely as possible.

Providing the information needed to determine the least recently used entry may require some effort, in both hardware and software systems. There are thus algorithms which approximate 'true' LRU, but use less overhead.

LRU algorithms are used in many circumstances: disk buffers (as above); page frames (in virtual memory); and caches of all kinds.