Set-Associative Caches and Conflict Misses

Map line addresses to cache sets and show how a stride can evict lines even when nominal capacity is large enough.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Each line has a limited set of places it can occupy
  2. Capacity and mapping bounds diagnose different patterns

Each line has a limited set of places it can occupy

For a simple cache with four sets and two ways, map a line number to its residue modulo four. Lines \(0,4,8\) all compete for the two places in set zero. Repeatedly cycling through them under least-recently-used replacement can miss on every access, though the cache holds eight lines in total. Changing the layout can distribute those lines across more sets.

Capacity and mapping bounds diagnose different patterns

A fully associative cache of the same total size could retain all three lines. Accessing nine distinct lines repeatedly instead exceeds even the total capacity of this example. Hashing or other index choices can change actual hardware mapping, so verify the model before applying a simple modulo argument. Cache miss analysis tracks line reuse. Matrix tiling reorganizes access to make several useful lines coexist.[1][2]

References

  1. RISC-V International, The RISC-V Instruction Set Manual: Unprivileged Architecture ↩
  2. MIT OpenCourseWare, Computation Structures ↩