Beyond Worst-case Analysis of Multicore Caching Strategies

Shahin Kamali, Helen Xu

This paper, originally presented at a SIAM conference, tackles a long-standing frustration in theoretical computer science: why do our mathematical models say multicore caching algorithms are terrible, even though they work perfectly well in the real world? Authors Shahin Kamali and Helen Xu introduce a new framework called cyclic analysis to bridge this gap.

TL;DR

Traditional worst-case analysis fails to distinguish between multicore caching strategies, often labeling them all as "unboundedly bad." This paper introduces cyclic analysis, a flexible theoretical framework that finally provides a mathematical proof for why popular strategies like Least-Recently-Used (LRU) are superior to others in multicore environments, especially when data access follows realistic patterns.

What Problem Does This Paper Address?

In a single-core system, caching is simple: if you need a piece of data not in the cache (a "miss"), you go get it. We know that the Least-Recently-Used (LRU) algorithm is quite good, and we have an "optimal" offline strategy (Furthest-In-Future) to compare it against.

However, in multicore systems where cores share a cache, things get messy. When one core misses, it stalls to fetch data (a "fetch delay"). During this delay, other cores keep running. This means the order in which requests reach the cache changes depending on which core missed and when. This is known as the "free-interleaving" model.

Under traditional "competitive analysis," which compares an online algorithm to an all-knowing offline adversary, almost every multicore algorithm looks like a failure. The adversary can craft specific request sequences that trick the online algorithm into a "high demand" state while the adversary avoids it. Because everything looks equally bad in the worst case, theory hasn't been able to tell us which algorithms are actually better.

Methods

The authors move away from the "competitive ratio" and instead propose cyclic analysis, a generalization of bijective analysis.

  • Direct Comparison: Instead of comparing an algorithm to an impossible-to-beat offline "OPT," cyclic analysis compares two online algorithms directly against each other over the entire universe of possible inputs.
  • Flexibility in Input Length: Traditional bijective analysis requires comparing inputs of the same length. This is hard in multicore caching because "length" could mean the number of requests or the total time taken. Cyclic analysis relaxes this, allowing researchers to map an input for Algorithm A to a different (perhaps longer or shorter) input for Algorithm B.
  • Locality of Reference: To make the analysis realistic, the authors use the "Max-Model." This restricts the "universe" of inputs to those that exhibit locality—meaning if a core accesses a page, it’s likely to access it (or related pages) again soon.

Datasets

As a theoretical paper, this work does not use empirical datasets (like SPEC benchmarks). Instead, it operates on the infinite set of all possible request sequences ($\mathcal{I}$) and a subset of sequences that satisfy the mathematical definition of locality ($\mathcal{I}^f$).

Key Insights and Ideas

  • The Scheduling Power of Eviction: In multicore systems, an eviction decision isn't just about memory; it's a scheduling decision. By choosing what to evict, an algorithm implicitly defines the future "schedule" of when cores will hit or miss.
  • Lazy is Better: The authors prove that "lazy" algorithms (those that only evict a page when the cache is absolutely full and a miss occurs) are strictly better than aggressive strategies like "Flush-When-Full" (FWF).
  • LRU’s Hidden Strength: While all lazy algorithms (like LRU and FIFO) perform similarly on totally random data, the authors prove that LRU is strictly better than any other lazy algorithm once you account for the "locality of reference" found in real-world software.
  • Total Time Metric: The paper advocates for using "Total Time" (the sum of time all cores spend processing) as a more realistic cost model than simply counting the number of misses.

Key Results

  • Equivalence of Lazy Algorithms: On a completely unrestricted set of inputs, all lazy multicore caching algorithms are equivalent under cyclic analysis.
  • Separation from FWF: The paper provides a formal proof that any lazy algorithm is strictly better than the Flush-When-Full (FWF) strategy.
  • The LRU Advantage: The core result is the mathematical separation of LRU. Under cyclic analysis, LRU is shown to be strictly better than all other lazy algorithms when the input sequences exhibit locality. This provides the theoretical justification for LRU's dominance in actual hardware.

Limitations and Future Work

The authors acknowledge that while their framework is general, some of the specific proofs regarding LRU's superiority were focused on the two-core ($p=2$) scenario to maintain clarity. Extending these proofs to a massive number of cores is a logical next step.

Additionally, while the "free-interleaving" model is a significant step up from older models, it still simplifies some aspects of modern hardware, such as complex bus contention or non-uniform memory access (NUMA). The authors suggest that cyclic analysis could be a powerful tool for other online problems where traditional worst-case analysis has proven too pessimistic, such as list update problems or broader scheduling tasks.

Summary updated

BibTeX
@inproceedings{kamali2021beyond,
  author = {Shahin Kamali and Helen Xu},
  title = {{Beyond Worst-case Analysis of Multicore Caching Strategies}},
  booktitle = {APOCS},
  year = {2021},
  doi = {10.1137/1.9781611976489.1},
}
Figure