{
  "slug": "statcache",
  "term": "StatCache",
  "aliases": [
    "StatCache cache model"
  ],
  "definition": "StatCache estimates fully associative random-replacement cache miss ratios from sampled intervals between references to the same cache line.",
  "note": "Mechanism: for L full cache slots, a resident line survives n independent uniform evictions with probability (1 - 1/L)^n. StatCache approximates the intervening miss count using a local miss ratio, solves an implicit equation and combines short-window estimates. [paper]\n\nNaming: its reuse distance counts all intervening references, not distinct lines. First references have no reuse interval, and the estimator excludes cold misses. The later StatStack model targets LRU instead. [paper] [project]\n\nWorked example: in an empty two-slot cache, ABCA has three certain cold misses and a 1/2 chance of missing the last A. The expected total is 3.5 misses across four requests, or 7/8. Excluding cold misses gives 1/8 per request, but 1/2 per reuse. B fills a free slot; only C can evict A before its reuse. [example]\n\nInterpretation: ABBA has the same two intervening references before the last A but no eviction. LRU misses all four ABCA requests. The exact synthetic ledgers illustrate accounting and policy differences, not StatCache accuracy or storage latency. [example]",
  "status": "research",
  "advantages": [],
  "limitations": [],
  "related": [
    "statstack",
    "reuse-time",
    "miss-ratio-curve"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-18",
  "citations": [
    {
      "id": "paper",
      "title": "Berg and Hagersten. StatCache: A Probabilistic Approach to Efficient and Accurate Data Locality Analysis. ISPASS 2004, sections 2-4.",
      "url": "https://www.it.uu.se/research/group/uart/pub/berg_2004_mar/berg_2004_mar.pdf",
      "accessed": "2026-11-18"
    },
    {
      "id": "project",
      "title": "Uppsala University. Efficient Modeling Technology: random-replacement and LRU models.",
      "url": "https://www.it.uu.se/research/upmarc/research/resource-man/resource-modeling-technology.html",
      "accessed": "2026-11-18"
    },
    {
      "id": "example",
      "title": "Hesela. Exact random-replacement state ledgers and cold-start denominators; constructed traces.",
      "url": "https://hesela.dev/research/statcache/evidence.json",
      "accessed": "2026-11-18"
    },
    {
      "id": "code",
      "title": "Hesela. Bounded exact random-replacement evaluator in Python.",
      "url": "https://hesela.dev/research/statcache/model.py",
      "accessed": "2026-11-18"
    },
    {
      "id": "tests",
      "title": "Hesela. Independent path-enumeration tests and accounting checks.",
      "url": "https://hesela.dev/research/statcache/test_model.py",
      "accessed": "2026-11-18"
    }
  ],
  "provenance": [
    "The full eight-page paper was reviewed. The original sampler, SPEC workloads and benchmark results were not reproduced.",
    "The example uses exact fractions over every possible replacement path, not Monte Carlo sampling or measured device behavior."
  ]
}
