Hardware Reference
In-Depth Information
Thus, blocks stay out of the cache in no-write allocate until the program tries to read the
blocks, but even blocks that are only writen will still be in the cache with write allocate. Let's
look at an example.
Example
Assume a fully associative write-back cache with many cache entries that starts
empty. Below is a sequence of five memory operations (the address is in square
brackets):
Write Mem[100];
Write Mem[100];
Read Mem[200];
Write Mem[200];
Write Mem[100].
What are the number of hits and misses when using no-write allocate versus
write allocate?
Answer
For no-write allocate, the address 100 is not in the cache, and there is no alloc-
ation on write, so the first two writes will result in misses. Address 200 is also
not in the cache, so the read is also a miss. The subsequent write to address 200
is a hit. The last write to 100 is still a miss. The result for no-write allocate is four
misses and one hit.
For write allocate, the first accesses to 100 and 200 are misses, and the rest are
hits since 100 and 200 are both found in the cache. Thus, the result for write al-
locate is two misses and three hits.
Either write miss policy could be used with write-through or write-back. Normally, write-
back caches use write allocate, hoping that subsequent writes to that block will be captured
by the cache. Write-through caches often use no-write allocate. The reasoning is that even if
there are subsequent writes to that block, the writes must still go to the lower-level memory,
so what's to be gained?
An Example: The Opteron Data Cache
To give substance to these ideas, Figure B.5 shows the organization of the data cache in
the AMD Opteron microprocessor. The cache contains 65,536 (64K) bytes of data in 64-byte
blocks with two-way set associative placement, least-recently used replacement, write-back,
and write allocate on a write miss.
Search WWH ::




Custom Search