What is Fully associative cache?

A cache organization in which any data can be placed in any location. It has no conflict misses but must compare against every tag, so it suits small structures such as TLBs rather than large caches.

Field: Memory Hierarchy

Japanese name: フルアソシアティブ方式

No index, only tag and offset

In a fully associative cache, the whole cache is one set, so any block can be stored in any line. No bits are needed to select a set: the index is 0 bits, and the address is split only into an offset within the line and a tag made of all remaining bits. On every access, the requested tag must be compared with the tags of all valid lines at once, which is typically done with content-addressable memory (CAM), where each entry has its own comparator.

Why it is used only for small structures

A CAM with N entries needs N wide comparators firing on every lookup, plus a large multiplexer to deliver the matching data. Area, power and hit time grow quickly with the number of entries, so large data caches are set-associative instead. Full associativity is affordable and worthwhile in small structures that see heavy use and where every miss is expensive, such as translation lookaside buffers (TLBs) that cache page-table entries, or small victim caches that hold lines recently evicted from a direct-mapped cache.

Replacement policy decides performance

Since any line can be evicted, the cache needs a replacement policy. Least recently used (LRU) evicts the line untouched for longest. With two lines and the reference string A, B, A, C, B, A, LRU gives five misses: the hit on A makes B the victim when C arrives, then A and C are evicted in turn. True LRU becomes costly to track for many entries, so hardware often uses pseudo-LRU or random replacement. LRU also performs badly on cyclic patterns slightly larger than the cache, where random can do better.

What full associativity cannot fix

Full associativity eliminates conflict misses, because blocks never compete for a particular set. In the usual three-category model, conflict misses are in fact defined as the misses that a fully associative cache of the same size would avoid. Compulsory misses on first access remain, as do capacity misses when the working set is larger than the whole cache. Those require a larger cache, prefetching, or restructuring code to reuse data sooner, for example by loop blocking (tiling).

Try it: questions about Fully associative cache

In a fully associative cache, how many address bits are used for the index (the part that selects a set)?

  1. A6 bits, determined by the line size
  2. BAs many bits as there are lines
  3. C0 bits
Show answer and explanation

Answer: C. 0 bits

In a fully associative cache any data can go anywhere, so the whole cache is a single set. No set needs to be selected, so the index is 0 bits; the address splits into just offset and tag, and every access compares against all tags. That requires many comparators, so it does not suit large caches and is used for small structures such as TLBs. The line size determines the offset width, not the index.

A fully associative cache holding 2 lines with LRU replacement starts empty. If blocks are referenced in the order A, B, A, C, B, A, how many misses occur?

  1. A4
  2. B5
  3. C6
Show answer and explanation

Answer: B. 5

Step by step: A (miss, [A]), B (miss, [A,B]), A (hit, A becomes most recent), C (miss, evicts least recent B, [A,C]), B (miss, evicts least recent A, [C,B]), A (miss, evicts least recent C, [B,A]), for 5 misses. Counting 4 comes from wrongly evicting A when C arrives; under LRU, the hit on A made it the most recent. 6 overlooks the hit on the third reference.

FAQ

How many index bits does a fully associative cache have?

Zero. The entire cache is a single set, so the address consists only of a tag and an offset, and the tag is compared against every line.

Why are TLBs often fully associative?

TLBs are small and every miss forces a costly page-table walk, so the extra comparators are worth it to avoid conflict misses entirely.

Does a fully associative cache eliminate all misses?

No. It removes conflict misses, but compulsory misses on first use and capacity misses from a working set larger than the cache still occur.

Questions that mention Fully associative cache (1)

Fully associative cache appears in 3 practice questions across 1 topic, including Memory Hierarchy.

  1. Which misses are not reduced even by making a cache fully associative?

Books on Memory Hierarchy Ad

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

Semiconductor, Electronics and Computing Calculators

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary