What is Write-allocate?

A policy that, on a write miss, first brings the line into the cache and then writes it. Usually paired with write-back; writing directly to the lower level without fetching is called no-write-allocate.

Field: Memory Hierarchy

Japanese name: ライトアロケート

What happens on a write miss

With write-allocate, a store that misses first fetches the whole line from the lower level, places it in the cache, and then merges the stored bytes into it. In a write-back cache the line is then marked dirty and reaches memory only when it is later evicted. In a multicore system the fetch also obtains exclusive ownership of the line, so other cores' copies are invalidated before the write; this read-for-ownership is why a store miss looks like a read on the memory bus.

Write-allocate vs. no-write-allocate

No-write-allocate sends a missed store directly to the lower level and leaves the cache untouched. Write-allocate pays off when written data is soon read or written again, because later accesses hit; it is therefore the usual partner of write-back. No-write-allocate suits data written once and not reused, and is the usual partner of write-through. Note that write-back versus write-through decides how hits are propagated, while allocation decides what a miss does; the two are separate choices.

The hidden cost for write-only data

When a program writes a large buffer it will not read soon, such as clearing memory or producing output, write-allocate first reads every line from memory only to overwrite it, then writes it back later, roughly doubling traffic. Those lines also evict useful data. Non-temporal or streaming stores avoid this by combining writes and sending them straight to memory. Some ISAs also offer instructions that zero a whole cache line without fetching its old contents.

Related miss-handling techniques

Write-allocate determines whether a line is brought in, but other techniques shape how long the miss takes. Critical word first sends the requested word ahead of the rest of the 64-byte line so the CPU can resume early. A write buffer hides store latency in write-through caches, and a victim cache holds recently evicted lines. Each addresses a different part of miss cost, which is a frequent source of confusion.

Try it: questions about Write-allocate

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.

Which policy, on a write miss, writes directly to the lower level without loading the line into the cache?

  1. AWrite-allocate
  2. BWrite-back
  3. CNo-write-allocate
Show answer and explanation

Answer: C. No-write-allocate

Writing straight to the lower level on a write miss without loading the line is no-write-allocate, commonly paired with write-through. It avoids useless fetches for data that is written once and not read back. Write-allocate instead loads the line and then writes it, which pays off when written data is soon reused, so it is commonly paired with write-back. Write-back governs when hits are propagated to memory, a separate axis from whether a miss loads the line.

FAQ

What is the difference between write-allocate and no-write-allocate?

On a write miss, write-allocate loads the line into the cache and writes it there, while no-write-allocate writes directly to the lower level without loading the line.

Why is write-allocate usually paired with write-back?

Once the line is in a write-back cache, further writes to it hit and are absorbed without memory traffic, so the cost of the initial fetch is recovered.

What are non-temporal stores used for?

They write large amounts of data that will not be reused soon directly to memory, avoiding the read of each line that write-allocate would cause and keeping the cache free for useful data.

Questions that mention Write-allocate (2)

Write-allocate appears in 4 practice questions across 1 topic, including Memory Hierarchy.

  1. 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?
  2. Which technique, when fetching a missed line from memory, sends the word the CPU needs first and the rest afterward?

Books on Memory Hierarchy Ad

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary