Memory Hierarchy

What is the main purpose of a write buffer in a write-through cache?

  1. ATo let the CPU continue without waiting for writes to main memory to complete
  2. BTo keep the data in the cache newer than in main memory
  3. CTo always fetch the line from main memory into the cache first on a write miss, then write it
Show answer and explanation

Answer: A. To let the CPU continue without waiting for writes to main memory to complete

A write-through cache also writes to main memory on every store, so waiting for each write to finish would stall the CPU constantly. A write buffer holds writes temporarily, letting the CPU move on immediately while the buffer drains to memory in the background. Keeping the cache newer than memory characterizes write-back caches; with write-through the two stay consistent. Whether to load a line on a write miss is the write-allocate decision, separate from the write buffer.

  • A. Correct. It holds writes temporarily so the CPU need not wait.
  • B. The cache becomes newer than memory under write-back.
  • C. Loading on a miss is the write-allocate decision.
Practice this topic Back to topic

More Memory Hierarchy questions

  1. In a write-back cache, what is the role of the dirty bit attached to each line?
  2. Which policy, on a write miss, writes directly to the lower level without loading the line into the cache?
  3. A fully associative cache holding 2 lines with LRU replacement starts empty. If blocks are referenced in the order A, B, A, C, B, A, how many misses occur?
  4. For which access pattern is hardware prefetching especially effective?
  5. When inserting software prefetch instructions, which statement about how far ahead to fetch (the prefetch distance) is correct?