CPUs and architecture

Which correctly describes a set-associative cache?

  1. AData for a given address can be placed in any of several locations (ways) within a fixed set
  2. BData for a given address can be placed in only one location in the cache
  3. CData can be placed anywhere in the cache
Show answer and explanation

Answer: A. Data for a given address can be placed in any of several locations (ways) within a fixed set

In a set-associative cache, part of the address selects a set, and data may occupy any of that set's ways—eight candidate slots in an 8-way cache—reducing conflict misses compared with direct mapping. More ways need more comparators and power, so the way count is kept moderate—for example, 8–12 ways for L1 and around 16 for L3. A cache in which data can go anywhere is fully associative.

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. Correct. It can be placed in several ways within a fixed set.
  • B. Only one possible location is a direct-mapped cache.
  • C. Being able to place data anywhere is a fully associative cache.

Related calculators

Books on CPUs and architecture Ad

As an Amazon Associate I earn from qualifying purchases.

More CPUs and architecture questions

  1. What is the typical size of a cache line (cache block) in many CPUs?
  2. In a pipeline, when the next instruction immediately uses the result of the previous one (a data hazard), which technique passes the result directly to the next instruction without waiting for it to be written to the register?
  3. Which correctly describes little-endian byte order?
  4. Which technique lets one CPU core process instructions from multiple threads at the same time to make better use of the core's execution units?
  5. In microcontrollers and similar devices, which scheme assigns peripheral registers to the same address space as memory and operates them with ordinary memory read/write instructions?

Comparisons in this topic