95% of all main memory accesses are found in the cache. 25% of references to the
ID: 3848349 • Letter: 9
Question
95% of all main memory accesses are found in the cache. 25% of references to the cache are writes. Each cache block is two words, and the whole block is read on any miss. At any time, 30% of the blocks in the cache have been modified. The cache uses write allocate on a write miss. The bus reads or writes a single word at a time (the memory system can not read or write two words at once). a. Assuming that write-through is used, find the average number of memory accesses per CPU reference to the cache. Note that when updating the block in memory, only the modified word is written to memory, not the entire block. b. Repeat part a, but assuming the cache uses write-back.Explanation / Answer
solution:
as We know thta :
Miss rate = 0.05
Block size = 2 words (8 bytes)
Frequency of memory operations from processor = 109
Frequency of writes from processor = 0.25 109
Bus can only transfer one word at a time to/from processor/memory
On average 30% of blocks in the cache have been modified (must be written back in the
case of the write back cache)
Cache is write allocate
So:
Fraction of read hits = 0.75 0.95 = 0.7125
Fraction of read misses = 0.75 0.05 = 0.0375
Fraction of write hits = 0.25 0.95 = 0.2375
Fraction of write misses = 0.25 0.05 = 0.0125
part a)
Write through cache
Then:
On a read hit there is no memory access
On a read miss memory must send two words to the cache
On a write hit the cache must send a word to memory
On a write miss memory must send two words to the cache, and then the cache must
send a word to memory
Thus:
Average words transferred = 0.7125 * 0 + 0.0375 * 2 + 0.2375 * 1 + 0.0125 * 3 = 0.35
Average bandwidth used = 0.35 * 10^9
Fraction of bandwidthused =(0.35 10^9)/10^9= 0.35
part b)
Write back cache
Then:
On a read hit there is no memory access
On a read miss:
1. If replaced line is modified then cache must send two words to memory, and then
memory must send two words to the cache
2. If replaced line is clean then memory must send two words to the cache
On a write hit there is no memory access
On a write miss:
1. If replaced line is modified then cache must send two words to memory, and then
memory must send two words to the cache
2. If replaced line is clean then memory must send two words to the cache
Thus:
Average words transferred
= 0.7125 * 0 + 0.0375 * (0.7 * 2 + 0.3 * 4) + 0.2375 * 0 + 0.0125 *(0.7 * 2 + 0.3 * 4) = 0.13
Average bandwidth used = 0.13 * 10^9
Fraction of bandwidthused =(0.13 10^9)/10^9= 0.13
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.