AlgoPlus//structures / cache-mapping
Read the theory

Cache Mapping

How an address finds its place in the cache — and why associativity cuts conflict misses.

Mapping
Direct-mapped
Hits
0
Miss rate
Mapping
Access sequence (byte addresses 0–255)
Legend
Tag
Index
Offset
AI Tutor Workspace
In a nutshell
A cache is small, so every block of memory needs a rule for where it is allowed to sit. The address is split into three parts: the offset picks the byte inside a block, the index picks which slot (set) to look in, and the tag confirms whether the block sitting there is the one you wanted. Direct-mapped gives each block exactly one slot — fast, but two blocks wanting that slot keep evicting each other; set-associative and fully associative give each block several slots, trading more tag comparisons for fewer collisions.
Ready
Press play to begin the cinematic walkthrough.
An address splits into tag · index · offset; the index selects a set and the tag identifies the block. Direct-mapped thrashes when blocks collide on an index; associativity gives each block several slots, cutting conflict misses.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for Cache Mapping.