Consider a cache with a line size of 128 bytes. A word consists of 4 bytes from
ID: 3713400 • Letter: C
Question
Consider a cache with a line size of 128 bytes. A word consists of 4 bytes from the memory (through the cache). Also assume 60% of the instructions require read operation, and 40% of the instructions require write operation. If a write-back policy is used, assume that on average 25% of the lines in the cache is dirty a. Assume there is a 3% miss rate (0.97 hit ratio) Compute the amount of main memory traffic, in terms of bytes per instruction for both write-through and write-back policies. Memory is read into cache one line at a time. However, for write, a single word can be written from cache to main memory b. Repeat part a for a 10% miss rate.Explanation / Answer
Before jumping to the solution, let's devlop some basic understanding.
First understand the difference between a write through and a write back cache.
In case of a write through, whenever a modification is made in the cache memory, it is immediately written to the main memory.
In case of a write back, whenever a modification is made in the cache memory, a bit corresponding to that particular chache line - referred to as the dirty bit- is set to 1. A dirty bit set to 1 therefore indicates that the block has been modified.Then after certain fixed time intervals (OS dependant) all of the dirty blocks are updated onto the main memory.
Now, a cache hit means that the particular block of memory is avaialble in the main memory. While a cache miss implies that the particular block is not avaible in the cache memory and has to be read or written from the main memory. That means, all the traffic that will be created in the main memory would be through cache misses.
Now let's try to solve the numerical.
In case one, trhe cache miss is 3%. out of this 60 % would be due to read and 40% due to writes. In case of write through caches, the 60% reads would cause a penalty of 128 bytes since it is mentioned that entire cache lines are read in a go. The rest 40% would account to a peanlty of 4 bytes. This is multiplied over the total number of instructions , ie- 1M or 10^6 to get: 10^6 (.03(.6*128+.4*4))
In case of write back the penalty for writes would be 40% of 25% of 4bytes. Since only 25% of the blocks need to be written back.
The final solution is:
a)
Write Through:
10^6 (.03(.6*128+.4*4))
Write back:
10^6 (.03(.6*128+.4*.25*4))
b)
Write Through:
10^6 (.03(.6*128+.4*4))
Write back:
10^6 (.1(.6*128+.4*.25*4))
Hope this helps! :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.