|
|
|
|
|
|
Figure 5.16
Write policies. (a) Write-through cache (no allocate on write); (b) Copyback
cache (allocate on write). |
|
|
|
|
|
|
|
|
2. Copyback In a copyback policy, the entire line is replaced in main memory if a write has occurred into that line. A line which has been unaltered when replaced is simply discarded, as the main memory continues to retain the correct contents of that line. In copyback, the selection of the line to be replaced is usually unaffected by the write policy (allocate or non-allocate on write), since that line is usually determined by the line replacement strategy (dictated only by reads). Thus, when a read miss occurs in copyback, either the new line is accessed from main memory and placed in the cache (if the replaced line was clean) or the replaced line is first written out and then the new line is accessed and put into the cache. Copyback caches require an additional bit associated with each line in the cache directory. This "dirty bit" is set on if a write occurs anywhere in the line. The presence of the dirty bit indicates that the line must be written out completely to main memory on replacement. For various traces consisting of S/370, VAX, and CDC 6400 data [259], the probability of a line being dirty is 47% on average, ranging from 22% to 80%. As a rule of thumb, we assume for our studies that 50% of the lines replaced from a data cache are dirty, and 30% of the lines from an integrated cache are dirty. |
|
|
|
|
|