Fetch on write) – Datum at the missed-write location is loaded to cache, followed by a write-hit operation. In this approach, write misses are similar to read-misses.
No-write allocate
(aka
Write-no-allocate,
Write around) – Datum at the missed-write location is not loaded to cache, and is written directly to the backing store. In this approach, actually only system reads are being cached.
write back:CPU更新cache時,只是把更新的cache區標記一下,並不同步更新memory。只是在cache區要被新進入的資料取代時,才更新memory。這樣做的原因是考慮到很多時候cache存入的是中間結果,沒有必要同步更新memory。優點是CPU執行的效率提高,缺點是實現起來技術比較複雜。
Write-misses寫缺失的處理方式
對於寫操作,存在寫入快取缺失資料的情況,這時有兩種處理方式:
Write allocate
(aka
Fetch on write) – Datum at the missed-write location is loaded to cache, followed by a write-hit operation. In this approach, write misses are similar to read-misses.
No-write allocate
(aka
Write-no-allocate,
Write around) – Datum at the missed-write location is not loaded to cache, and is written directly to the backing store. In this approach, actually only system reads are being cached.
Write allocate方式將寫入位置讀入快取,然後採用write-hit(快取命中寫入)操作。寫缺失操作與讀缺失操作類似。
No-write allocate方式並不將寫入位置讀入快取,而是直接將資料寫入儲存。這種方式下,只有讀操作會被快取。
無論是Write-through還是Write-back都可以使用寫缺失的兩種方式之一。只是通常Write-back採用Write allocate方式,而Write-through採用No-write allocate方式;因為多次寫入同一快取時,Write allocate配合Write-back可以提升效能;而對於Write-through則沒有幫助。