{
  "slug": "locality-of-reference",
  "term": "Locality of reference",
  "aliases": [
    "reference locality",
    "locality principle"
  ],
  "definition": "Locality of reference is the tendency to reuse recently accessed data or access nearby addresses within a short interval.",
  "note": "Temporal locality concerns reuse of the same data over a short interval; spatial locality concerns nearby addresses in a specified address space. These patterns motivate caching and fetching neighboring data, but do not guarantee a speedup. [denning-locality]\n\nNonsequential accesses can repeatedly visit a small set, while a sequential one-pass scan need not revisit any entry. Evaluate the pattern at the cache-entry granularity and observation interval, rather than treating random I/O as the absence of locality. This is a distinction between access order and reuse, not a measurement of a device. [denning-locality] [counter-stacks]\n\nA working-set size summarizes distinct entries in a chosen window. Reuse distance instead counts distinct identities strictly between consecutive references to one entry; the two measurements answer different questions. This is the zero-based reuse-distance convention; some papers instead count a one-based stack position. [denning-ws] [reuse-report] [counter-stacks]\n\nAn upstream cache can absorb repeated reads before they reach a lower storage layer. A device-level trace therefore need not expose the application's reuse pattern; comparisons must name the observation point and history interval. [counter-stacks]",
  "status": "research",
  "advantages": [],
  "limitations": [
    {
      "text": "Locality depends on the observation layer and granularity; a workload label alone does not establish a cache hit ratio.",
      "citationIds": [
        "counter-stacks"
      ]
    }
  ],
  "related": [
    "working-set",
    "reuse-distance",
    "miss-ratio-curve",
    "mapping-cache",
    "page-cache",
    "cache-pollution"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-24",
  "citations": [
    {
      "id": "denning-locality",
      "title": "Peter J. Denning. The Locality Principle. Communications of the ACM 48(7), July 2005, pp. 19-24.",
      "url": "https://denninginstitute.com/pjd/PUBS/CACMcols/cacmJul05.pdf",
      "accessed": "2026-10-24"
    },
    {
      "id": "denning-ws",
      "title": "Peter J. Denning. The Working Set Model for Program Behavior. Communications of the ACM 11(5), May 1968, pp. 323-333, section 3.",
      "url": "https://denninginstitute.com/pjd/PUBS/WSModel_1968.pdf",
      "accessed": "2026-10-24"
    },
    {
      "id": "counter-stacks",
      "title": "Wires et al. Characterizing Storage Workloads with Counter Stacks. OSDI 2014, sections 2 and 3.2.",
      "url": "https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-wires.pdf",
      "accessed": "2026-10-24"
    },
    {
      "id": "reuse-report",
      "title": "Ding and Zhong. Reuse Distance Analysis. UR-CS-TR-741, February 2001, section 2.1 and Figures 1-3.",
      "url": "https://www.cs.rochester.edu/u/cding/Documents/Publications/TR741.pdf",
      "accessed": "2026-10-24"
    },
    {
      "id": "hesela",
      "title": "Hesela: working-set windows, locality and mapping-cache units.",
      "url": "https://hesela.com/analyses/ssd-mapping-cache-hmb/#working-set",
      "accessed": "2026-10-24"
    }
  ],
  "provenance": [
    "Denning 2005 discusses temporal and spatial clustering and locality phases; Wires et al. provides storage-cache trace context.",
    "The sequential/nonsequential distinction is an engineering interpretation, not a device performance result.",
    "Repair locality and storage-tier temperature are separate existing concepts, not aliases of reference locality."
  ]
}
