# What does "associative" exactly mean in "n-way set-associative cache"?

I'm trying to grasp what does associative actually mean in n-way set-associative cache. I understand n-way set-associative cache as a concept; n is the degree of associativity, i.e., how many cache lines a set can hold.

If I take associative to mean "having the tendency to connect", I get to the "sets tend to connect to...", what, memory addresses?

But I'm not sure if this is the correct understanding.

• It needn't have any literal meaning. It's just a name. Nov 8 '20 at 21:24
• It seems associate here comes from every memory location is associated with $n$ cache lines. Nov 9 '20 at 6:25

## 1 Answer

An n-way set associative cache is a cache that is chopped up in sections called sets. And each set can hold n-blocks.

A cache-address can be broken up up in 3 parts.

• the offset within the block
• the index that identifies the set
• the tag that identifies the block in the set.

When a request comes in, the index is calculated to identify the set. Then the tags of all blocks in the set are checked. And when a block with a matching tag is found, the right bytes are returned based on the offset.

A direct mapped cached is effectively a 1 way set associative cache.

So associativity doesn't mean the number of blocks the cache can hold, but the number of blocks a set within the cache can hold.

The big advantage of a n-way set associative cache compared to a direct mapped cache, is the latter can only have a single block for a set of addresses and the former can hold multiple blocks for a set of addresses.