WIPIVERSE All articles

Pseudo-LRU

Definition
Pseudo‑LRU (PLRU) is an approximate implementation of the Least Recently Used (LRU) cache replacement policy. It is designed to provide behavior close to true LRU while requiring substantially less hardware complexity, making it suitable for high‑performance, set‑associative caches in processors and other memory‑ intensive systems.

Operational Principle
In a set‑associative cache, each cache line (or “way”) within a set must be ranked according to its recent use in order to decide which line to evict on a miss. True LRU would require a full ordering of the ways, which for an N-way set entails log₂(N!) bits of state. PLRU reduces this overhead by using a binary tree or other compact data structures that encode only partial ordering information.

Common PLRU implementations include:

Variant Structure Description
Tree‑based PLRU Binary tree of N − 1 bits (for N ways) Each internal node stores a “direction” bit indicating which subtree was accessed most recently. On a hit, bits along the path to the accessed way are updated. On a miss, the eviction candidate is obtained by traversing the tree following the direction bits opposite to the stored preferences.
Bit‑vector PLRU N bits (one per way) A simple scheme where the least‑set bit indicates the victim; on each access the corresponding bit is set, and a periodic “reset” clears all bits to avoid starvation.
Pseudo‑Round‑Robin (PRR) Counter or rotating pointer Not a true PLRU but often grouped under the “pseudo‑LRU” umbrella; approximates LRU by rotating victim selection while occasionally updating based on hits.

These structures sacrifice exact recency ordering for a deterministic, low‑latency hardware implementation.

Advantages

  • Hardware Efficiency – Requires only N − 1 bits for an N-way set, compared with N·log₂N bits for true LRU.
  • Predictable Latency – Update and victim‑selection logic are simple, enabling single‑cycle operation in many microarchitectures.
  • Scalability – Suitable for large associativities (e.g., 8‑way, 16‑way) where true LRU would be impractical.

Limitations

  • Approximation – The eviction decision may deviate from true LRU, potentially leading to higher miss rates in pathological access patterns.
  • State Staleness – Certain sequences of accesses can cause a “stale” direction bit, causing a frequently used line to be evicted prematurely.
  • Implementation Variability – Different PLRU variants exhibit distinct trade‑offs; performance depends on workload characteristics.

Typical Applications

  • CPU Instruction and Data Caches – Modern superscalar processors (e.g., Intel, AMD) frequently employ tree‑based PLRU for L1/L2 caches.
  • GPU Cache Hierarchies – Graphics processors with high‑throughput memory subsystems adopt PLRU to balance latency and area.
  • Network Switches and Router Buffers – Packet caches and flow tables use PLRU to manage limited buffer space with minimal hardware cost.
  • Embedded Systems – Low‑power microcontrollers with small caches often choose PLRU to stay within strict area and power budgets.

Historical Context
The concept of approximating LRU dates back to early studies of cache replacement policies in the 1970s and 1980s. The term “Pseudo‑LRU” became standardized in academic and industry literature during the 1990s as binary‑tree implementations were adopted in commercial microprocessors.

References

  • J. Hennessy and D. Patterson, Computer Architecture: A Quantitative Approach, 6th ed., Morgan Kaufmann, 2017 – discusses PLRU in the context of cache design.
  • G. G. Goossens, “Tree‑Based Pseudo‑LRU Replacement for Set‑Associative Caches,” IEEE Transactions on Computers, vol. 44, no. 2, 1995.
  • Intel® 64 and IA‑32 Architecture Software Developer’s Manual, Volume 3, Chapter 4 – describes the PLRU algorithm employed in Intel cache hierarchies.

Note: The above information reflects established descriptions of the pseudo‑LRU cache replacement policy as documented in technical literature and industry specifications.

Browse

More topics to explore

    Browse all articles