ArticleslgStudy

computer science

Adaptive replacement cache

Adaptive replacement cache is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Adaptive replacement cache rather than just read about it. In short: Adaptive Replacement Cache (ARC) is a page replacement algorithm with better performance than LRU (least recently used). This is accomplished by keeping track of both frequently used and recently used pages plus a recent eviction history for both.

Key takeaways

  • Adaptive replacement cache belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Adaptive replacement cache to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Adaptive replacement cache from memory before moving on to harder problems.

Reference excerpt

Adaptive Replacement Cache (ARC) is a page replacement algorithm with better performance than LRU (least recently used). This is accomplished by keeping track of both frequently used and recently used pages plus a recent eviction history for both. The algorithm was developed at the IBM Almaden Research Center. In 2006, IBM was granted a patent for the adaptive replacement cache policy.

Summary Basic LRU maintains an ordered list (the cache directory) of resource entries in the cache, with the sort order based on the time of most recent access. New entries are added at the top of the list, after the bottom entry has been evicted. Cache hits move to the top, pushing all other entries down. ARC improves the basic LRU strategy by splitting the cache directory into two lists, T1 and T2, for recently and frequently referenced entries. In turn, each of these is extended with a ghost list (B1 or B2), which is attached to the bottom of the two lists. These ghost lists act as scorecards by keeping track of the history of recently evicted cache entries, and the algorithm uses ghost hits to adapt to recent change in resource usage. Note that the ghost lists only contain metadata (keys for the entries) and not the resource data itself, i.e. as an entry is evicted into a ghost list its data is discarded. The combined cache directory is organised in four LRU lists:

T1, for recent cache entries. T2, for frequent entries, referenced at least twice. B1, ghost entries recently evicted from the T1 cache, but are still tracked. B2, similar ghost entries, but evicted from T2. T1 and B1 together are referred to as L1, a combined history of recent single references. Similarly, L2 is the combination of T2 and B2. The whole cache directory can be visualised in a single line :

. . . [ B1 <-[ T1 <-!-> T2 ]-> B2 ] . . [ . . . . [ . . . . . . ! . .^. . . . ] . . . . ] [ fixed cache size (c) ]

The inner [ ] brackets indicate actual cache, which although fixed in size, can move freely across the B1 and B2 history. L1 is now displayed from right to left, starting at the top, indicated by the ! marker. ^ indicates the target size for T1, and may be equal to, smaller than, or larger than the actual size (as indicated by !).

New entries enter T1, to the left of !, and are gradually pushed to the left, eventually being evicted from T1 into B1, and finally dropped out altogether. Any entry in L1 that gets referenced once more, gets another chance, and enters L2, just to the right of the central ! marker. From there, it is again pushed outward, from T2 into B2. Entries in L2 that get another hit can repeat this indefinitely, until they finally drop out on the far right of B2.

Replacement Entries (re-)entering the cache (T1, T2) will cause ! to move towards the target marker ^. If no free space exists in the cache, this marker also determines whether either T1 or T2 will evict an entry.

Hits in B1 will increase the size of T1, pushing ^ to the right. The last entry in T2 is evicted into B2. Hits in B2 will shrink T1, pushing ^ back to the left. The last entry in T1 is now evicted into B1. A cache miss will not affect ^, but the ! boundary will move closer to ^..

Deployment ARC is currently deployed in IBM's DS6000/DS8000 storage controllers. Sun Microsystems's scalable file system ZFS uses a variant of ARC as an alternative to the traditional Solaris filesystem page cache in virtual memory. It has been modified to allow for locked pages that are currently in use and cannot be vacated. PostgreSQL used ARC in its buffer manager for a brief time (version 8.0.0), but quickly replaced it with another algorithm, citing concerns over an IBM patent on ARC. VMware's vSAN (formerly Virtual SAN) is a hyper-converged, software-defined storage (SDS) product developed by VMware. It uses A variant of ARC in its Caching Algorithm. OpenZFS supports using ARC and L2ARC in a multi-level cache as read caches. In OpenZFS, disk reads often hit the first level disk cache in RAM using ARC. If a SSD is set up to store the second level disk cache, it is called an L2ARC. L2ARC uses the same ARC algorithm, but instead of storing the cached data in RAM, L2ARC stores the cached data in a fast SSD.

See also Clock with Adaptive Replacement LIRS caching algorithm

References

External links ARC: A Self-Tuning, Low Overhead Replacement Cache (2003) by Nimrod Megiddo, Dharmendra Modha Linux Memory Management Wiki Bourbonnais, Roch. ZFS Dynamics Python implementation, recipe 576532 Comparison of LRU, ARC and others

Worked examples

Example 1 — a first encounter with Adaptive replacement cache

Start with the simplest possible case. Write down what Adaptive replacement cache claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Adaptive replacement cache before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Adaptive replacement cache ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Adaptive replacement cache

In research
Adaptive replacement cache appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Adaptive replacement cache in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Adaptive replacement cache is common in secondary-school and first-year university syllabi. It links to neighbouring topics Memory management algorithms, Virtual memory, so understanding it makes those chapters shorter.
In everyday life
Look for Adaptive replacement cache outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Adaptive replacement cache” →

How to study Adaptive replacement cache in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Adaptive replacement cache means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Adaptive replacement cache out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Adaptive replacement cache in simple terms?

Adaptive Replacement Cache (ARC) is a page replacement algorithm with better performance than LRU (least recently used). This is accomplished by keeping track of both frequently used and recently used pages plus a recent eviction history for both.

Why does Adaptive replacement cache matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Adaptive replacement cache?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Adaptive replacement cache.

Tags

  • Memory management algorithms
  • Virtual memory

Keep exploring