Memory Hierarchy

In an 8-way set-associative cache, how many tags are compared in parallel on each access?

  1. AAs many as there are lines in the whole cache
  2. B8
  3. C1
Show answer and explanation

Answer: B. 8

A set-associative cache first selects one set with the index bits, then compares the tags of every way in that set in parallel. With 8 ways a set holds 8 lines, so 8 tags are compared, requiring 8 comparators. Comparing against every line in the cache is fully associative, and comparing just one is direct-mapped. More ways mean more comparators and power, which is why L1 associativity is often kept modest.

Lookup in a set-associative cache Address Offset: position in line Tag Index Offset Way 0 Tag Data Way 1 Tag Data Selects set = = Compare tags Any match → hit No match → miss Address tag vs. every way's tag at once 2-way example (n-way compares n tags)
Lookup in a set-associative cache · View in diagrams
  • A. Comparing against every line is fully associative.
  • B. Correct. It compares the tags of the 8 ways in the selected set.
  • C. Comparing only one tag is direct-mapped.

Related calculators

Books on Memory Hierarchy Ad

As an Amazon Associate I earn from qualifying purchases.

More Memory Hierarchy questions

  1. In a cache with 64-byte lines and 64 sets, which set holds the data at address 0x1234?
  2. For code that writes to the same line many times, why is a write-back cache more advantageous than write-through?
  3. In contrast to LRU, which evicts the least recently used block, optimal replacement (OPT) evicts the block that will not be used for the longest time. Which statement about OPT is correct?
  4. What generally happens to hit time as cache capacity increases, and why?
  5. Why does traversing the linked list above tend to be much slower than reading an array with the same number of elements in order?

Comparisons in this topic