5

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.

John L.
  • 39,205
  • 4
  • 34
  • 93
adder
  • 191
  • 1
  • 5

1 Answers1

5

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.

pveentjer
  • 349
  • 2
  • 7