Least recently used replacement
Least recently used replacement evicts the resident entry whose most recent access is oldest.
One-time scans can evict reusable entries. [1]
Under equal-size, fully associative demand caching, LRU preserves resident-set inclusion as capacity grows. [3]
For zero-based distinct-entry reuse distance d and C slots, a repeated access hits exactly when d < C under those assumptions. First appearances are cold in an empty-cache replay. [4]
Exact LRU tracks the latest access order. CAR describes a shared-list implementation whose MRU updates serialize behind a lock; this is not a universal global-lock requirement. [1] RocksDB documents a per-shard mutex and separate capacity budgets: local LRU order is not one global LRU order over the full cache. [9]
Recency alone ignores how often an entry is used. [1] A cyclic pattern slightly larger than the cache makes LRU evict the entries needed soonest, and with 100 index blocks referenced with probability 0.005 and 10,000 record blocks with 0.00005, LRU keeps about as many record blocks as index blocks. [6] The familiar B-competitive guarantee concerns demand paging with equal-size pages, unit fault cost and an offline optimum of the same capacity B. The general bound allows an additive initial-state term; it counts faults, not elapsed time, lock contention or variable-size byte traffic. [8] The 2Q introduction summarizes the multiplicative comparison. [5]
Operating systems approximate it: a page cache can keep inactive and active clock lists, admit new pages to the inactive list and promote pages accessed twice, because tracking every access is too expensive. [7] An exact LRU cache of 100 entries hits on every access of a loop over 100 entries in steady state and never hits on a loop over 101.
Relations
- related
- Clean-First LRU (CFLRU), Clean-First Dirty-Clustered (CFDC), Cache pollution, SSD mapping cache, Adaptive Replacement Cache, SIEVE cache eviction, CLOCK cache replacement, Cache inclusion property, First-in first-out cache replacement, Belady anomaly, Reuse distance, Miss-ratio curve, Ghost cache entry, Delayed cache hit, Low inter-reference recency set replacement, LRU-K replacement, Multi-Queue cache replacement, LeCaR, CACHEUS, Segmented LRU, Che approximation, Independent reference model, MIMIR, Cliffhanger, AMP buffer caching, Tsetlin library
Advantages
- Recency-list updates have constant work per access and constant metadata per resident entry, not constant total cache space; the CAR paper's optimality claim assumes a stack-depth-distribution workload model. [1]
Limitations
- In the two-pool example with a 150-entry cache, an exact LRU simulation reaches a hit ratio of 0.30, while keeping all 100 index blocks would give 0.5025. [6]
Citations
- Sorav Bansal and Dharmendra S. Modha. CAR: Clock with Adaptive Replacement. FAST 2004; sections III-V.
- Wires et al. Characterizing Storage Workloads with Counter Stacks. OSDI 2014, sections 2-3.
- Ding and Zhong. Reuse Distance Analysis. UR-CS-TR-741, February 2001, section 2.1 and Figures 1-3.
- Johnson and Shasha. 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. VLDB 1994, pp. 439-450.
- Jiang and Zhang. LIRS: An Efficient Low Inter-reference Recency Set Replacement Policy to Improve Buffer Cache Performance. SIGMETRICS 2002.
- Linux v6.12 mm/workingset.c, leading comment on double CLOCK lists and shadow entries.
- Sleator and Tarjan. Amortized Efficiency of List Update and Paging Rules. CACM 28(2), 202-208 (1985), section 4, Theorem 6. DOI 10.1145/2786.2793.
- RocksDB project. Block Cache: sharding, capacity division and LRU Cache per-shard mutex. Implementation documentation, not a benchmark.
Further reading
Sources & caveats
- The CAR and ARC papers have an author at an industrial research laboratory, the 2Q paper has one author also listed at a software company, and the LIRS paper is university work read from the author-hosted technical report TR-02-6.
- The kernel behaviour is taken from the v6.12 source comment, which describes the design rather than measuring it.
- The 0.30 hit ratio and the loop results come from a constructed exact-LRU simulation in Python with fixed seeds, not from a measurement of any system.
- Arithmetic: 0.5 + 0.5 x 50 / 10,000 = 0.5025; 0.5 / 100 = 0.005 and 0.5 / 10,000 = 0.00005 match the quoted probabilities.
- Performance claims of the cited papers for their own policies are not repeated.
- The 2026-10-25 correction uses Sleator and Tarjan section 4 for the fault-count model and initial-state allowance, and RocksDB documentation for an implementation counterexample to a universal global lock. No concurrent-cache benchmark was run.