Memory Hierarchy

For code that writes to the same line many times, why is a write-back cache more advantageous than write-through?

  1. AWrites complete within the cache, and memory is written only once when the line is evicted
  2. BMemory is updated on every write, so no work is needed at eviction
  3. CCache and memory always match, so no coherence management is needed
Show answer and explanation

Answer: A. Writes complete within the cache, and memory is written only once when the line is evicted

A write-back cache absorbs repeated writes to the same line within the cache and writes the dirty line back just once on eviction, greatly reducing memory traffic and power. Updating memory on every write is the write-through behavior, which generates traffic each time the line is written. Cache and memory always matching is also write-through; with write-back they differ for a while.

  • A. Correct. Many writes collapse into one write-back at eviction.
  • B. Updating memory on every write is write-through.
  • C. Always matching is write-through; with write-back they can differ.
Practice this topic Back to topic

More Memory Hierarchy questions

  1. 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?
  2. What generally happens to hit time as cache capacity increases, and why?
  3. Why does traversing the linked list above tend to be much slower than reading an array with the same number of elements in order?
  4. 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)?
  5. When writing out a large amount of data that will not be read back for a while, what is the main benefit of non-temporal stores that bypass the cache?