Cache Write Policy: Write Through versus Write Back
Cache read is much easier to handle than cache write:
- Instruction cache is much easier to design than data cache
Cache write:
- How do we keep data in the cache and memory consistent?
Two options (decision time again :-)
- Write Back: write to cache only. Write the cache block to memory when that cache block is being replaced on a cache miss.
- Need a “dirty bit” for each cache block
- Greatly reduce the memory bandwidth requirement
- Control can be complex
- Write Through: write to cache and memory at the same time.
- What!!! How can this be? Isn’t memory too slow for this?