1
$\begingroup$

If the processor is trying to write a word to a certain memory location, and the system uses a write-back style architecture, what happens in case of a miss? I'm assuming that the system would first load the cache line, update the specific word, and keep the cache line in the cache until it has to be replaced. Then it would commence the write-back operation upon removal.

So, the penalty for a missed write-back is actually a cache line read, correct?

$\endgroup$
2
  • $\begingroup$ But it's also possible that instead of loading the entire block (just for a single write operation) the system will instead write directly to the main memory. I'm not sure which of the two is correct. $\endgroup$
    – Dave
    Apr 11, 2016 at 13:52
  • 1
    $\begingroup$ Write back caches are typically write allocate and the remaining data is read to fill the cache line. The read delay to fill the cache line can be hidden by using a write buffer. If cache lines track validity at finer granularity, it would be possible to allocate a cache line on a write and avoid reading any content that can be marked as not present with valid bits. A writeback cache could be no-write-allocate, in which case a write miss would bypass that cache. No-write-allocate can avoid cache pollution for write streams and can be beneficial in small, low-associativity caches. $\endgroup$
    – user4577
    Apr 11, 2016 at 17:53

1 Answer 1

1
$\begingroup$

Depends on what you mean by "penalty". In theory (and in practice in high performance processors), a store does not need to stall subsequent instructions, so there's essentially no penalty at all from a store miss.

If you're talking about issue-to-commit time (i.e. when the store can be considered permanent) then the latency would indeed be when the cache line read occurs.

NOTE:

Most if not all architectures (ARM for example) allow non-temporal store hints. In practice most processors treat these as non-cacheable stores. So they go directly to memory without the need to grab the data into cache.

Some microarchitectures detect store streams to a temporal block. They support a type of RdNoData command that simply grabs store permissions without transferring data.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.