Calculating average time for a memory access
<p>I find it hard to understand the differences between the local and global miss rate and how to calculate the average time for a memory access and would just like to give an example of a problem that I have tried to solve. I would appreciate if someone could tell me if I'm on the right track, or if I'm wrong what I have missed.</p>
<p>Consider the following multilevel cache hierarchy with their seek times and miss rates:</p>
<ul>
<li>L1-cache, 0.5 ns, 20%</li>
<li>L2-cache, 1.8 ns, 5%</li>
<li>L3-cache, 4.2 ns, 1.5%</li>
<li>Main memory, 70 ns, 0%</li>
</ul>
<p>In this case, the seek times given refer to the total time it takes to both check whether the requested data is available on the current level of hierarchy, and transmit the data to the level above (or to the CPU). This is the same as hit time, right?
The miss rates given are local. And as I have understood, the a miss rate of one level needs to be multiplied with the miss rates of all previous levels in order to be correct for that level.</p>
<p>Lets say if we have 1000 memory accesses, in L1 20% of them will miss. So 20% of them will go to L2, there 5% of these will miss. So from 1000 memory accesses 1000 * 20% * 5% will get there.
Now, as far as I know... and please correct me if I am wrong, the above miss rates are local, but their product is the global missrate for each corresponding level. This means the global miss rate would be 0,2*0,05 = 1% for L2.</p>
<p>Now, I may be very wrong with this calculation but this is how I think:</p>
<pre><code>AMAT (Average Memory Access Time) = Hit time + Miss rate * Miss penalty

AMAT = 0.5 + 0.2 * (1.8 + 0.2 * 0.05 * (4.2 + 0.2 * 0.05 * 0.015 * 70))
</code></pre>
<p>After calculating this I get AMAT = 0.868421 ns</p>
<p>Am I doing this correctly?</p>