Memory Hierarchy

In a cache with 64-byte lines and 64 sets, which set holds the data at address 0x1234?

  1. A4
  2. B52
  3. C8
Show answer and explanation

Answer: C. 8

The offset is the low 6 bits (64 = 2⁶), and the index is the next 6 bits (64 sets = 2⁶). 0x1234 = 4,660, and 4,660 ÷ 64 = 72 remainder 52, so the line number is 72. The set number is the line number modulo the set count: 72 mod 64 = 8. 52 is the remainder, the position within the line (offset). 4 is merely the last hexadecimal digit of the address and has nothing to do with the set.

  • A. 4 is just the last hex digit and unrelated to the set.
  • B. 52 is the position within the line (offset).
  • C. Correct. Line number 72 modulo 64 gives 8.
Practice this topic Back to topic

More Memory Hierarchy questions

  1. For code that writes to the same line many times, why is a write-back cache more advantageous than write-through?
  2. 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?
  3. What generally happens to hit time as cache capacity increases, and why?
  4. Why does traversing the linked list above tend to be much slower than reading an array with the same number of elements in order?
  5. Each miss fetches a 64-byte line and memory latency is 100 ns. With only one miss outstanding at a time, read bandwidth is about 0.64 GB/s. If 10 misses can be outstanding at once, what is the bandwidth approximately (assuming no other limits)?