| |
其实就是diligence matches laziness。
Why:
‘Write back’ caches use ‘write allocate’
‘Write through’ caches use ‘no-write allocate’
Answer:
‘Write back’ means: If write-hit in cache, update cache contents only and delay updating memory. This idea is based on the Temporal Locality, for this address block we have just updated is highly probable that it would be updated (written) again in a short time period. If we only update the cache and update the memory only when it is necessary, we can reduce the frequency of writing memory, thus accelerates writing.
‘Write allocate’ mean: If write-not-hit in cache, update in memory and put the address block into cache afterwards. This idea is also based on the Temporal Locality, for the address block we have just updated is highly probable that it would be read in a short time period. If we put this block into cache, it would be much faster for the next reading step.
Now we can see some good reasons for their combination in usage.
1.
2.
3.
Similarly, we can analyze the ‘write-through’ policy and its combination with ‘no write allocate’. ‘Write through’ provides a real-time-updated memory and it is unnecessary to fetch the address block into cache any more. It matches the policy ‘no write allocate’.