Skip to main content

Cache write policy techniques

Short answer

Write-through updates both cache and main memory on every write, keeping memory current but causing high traffic. Write-back updates only the cache and sets a dirty bit, writing to memory only on replacement, which is faster and reduces bus traffic but makes memory stale. Write-once uses write-through for the first write and write-back afterwards for coherence.

Explain the different write policy techniques in cache memory.

When the CPU writes to a cached word, the cache and main memory may become different. The write policy decides when main memory is updated.

  1. Write-through: every write goes to both the cache and main memory at once. Memory is always up to date and the design is simple, but write traffic is high and the CPU may wait for the slow memory (a write buffer reduces this).
  2. Write-back (copy-back): a write updates only the cache and sets a dirty bit on the line. Main memory is updated only when the line is replaced. Writes are fast and the bus traffic is low, but memory is temporarily stale and the control is more complex (important in multiprocessors).
  3. Write-once: the first write to a block is written through (to tell other caches), later writes are write-back. It is used for cache coherence in multiprocessor systems.

On a write miss the cache uses either write-allocate (load the block, then write) or no-write-allocate (write directly to memory).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Organization and Architecture chapter 6 questions →