Calculating average time for a memory access

13,679

Now it has become clear to me what exactly global and local miss rate is, and thus I realize I made a mistake in my calculation.

Before, the calculation looked like this:

AMAT = 0.5 + 0.2 * (1.8 + 0.2 * 0.05 * (4.2 + 0.2 * 0.05 * 0.015 * 70)) = 0.868421 ns

This means that the local miss rate of, for example, L1, affects the contributions of miss penalty for each further away in the hierarchy, too many times.. when it already has been accounted for in a previous stage.

The correct solution should be:

AMAT = 0.5 + 0.2 * (1.8 + 0.05 * (4.2 + 0.015 * 70)) = 0.9125 ns

So, recursively we can define:

AMAT = L1 Hit time + L1 Miss rate * L1 Miss penalty

L1 Miss penalty = L2 Hit time + L2 Miss rate * L2 Miss penalty

L2 Miss penalty = L3 Hit time + L3 Miss rate * L3 Miss penalty

L3 Miss penalty = Main memory hit time

Share:
13,679
Great Cubicuboctahedron
Author by

Great Cubicuboctahedron

Updated on June 04, 2022

Comments

  • Great Cubicuboctahedron
    Great Cubicuboctahedron almost 2 years

    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.

    Consider the following multilevel cache hierarchy with their seek times and miss rates:

    • L1-cache, 0.5 ns, 20%
    • L2-cache, 1.8 ns, 5%
    • L3-cache, 4.2 ns, 1.5%
    • Main memory, 70 ns, 0%

    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.

    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.

    Now, I may be very wrong with this calculation but this is how I think:

    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))
    

    After calculating this I get AMAT = 0.868421 ns

    Am I doing this correctly?