0
$\begingroup$

In a two-level cache system, the level one cache has a hit time of 1 ns (inside the CPU), hit rate of 90%, and a miss penalty of 20 ns. The level two cache has a hit rate of 95% and a miss penalty of 220 ns. What is the average memory access time?

What is a two-level cache system and how to calculate the time required? Since the hit time of level two cache is missing...

$\endgroup$
1
  • $\begingroup$ What is a two-level cache system and how to calculate the time required? Please offer an educated guess. $\endgroup$
    – greybeard
    Aug 5, 2021 at 6:38

2 Answers 2

1
$\begingroup$

First Let's define all given things

  • L1 Cache hit: 90% & Time: 1ns

L2 and RAM has hit rate 10% out of which 95% which is 9.5% in total

  • L2 Cache hit: 9.5% & Time 20ns

RAM has hit rate 5% of 10% = 0.5%

  • RAM hit: 0.5% & Time 220ns

Formula Avg Memory Access Time

AMAT = L1_hit * L1_T + L2_hit * L2_T + RAM_hit * RAM_T

AMAT = 0.9*1 + 9.5*20 + 0.5*220

AMAT = 300.9ns

What is 2 level cache system:

First cache called L1 is reside on CPU is too fast. When CPU needs data, it checks in L1 cache but if it is not there it will go to L2. L2 cache is sometimes on CPU or outside CPU it depends on architecture of CPU. It does similarly and here also it missed then it fetch data from RAM which is expensive process.

$\endgroup$
1
  • $\begingroup$ Well, your cache slows down average memory access from RAMs ≤220 ns to 300.9 ns. Get rid of it. $\endgroup$
    – greybeard
    Aug 5, 2021 at 6:47
0
$\begingroup$

Shouldn't the answer be 3.9ns? When looking at the percentages you gave AMAT = .9 * 1 + 9.5 * 20 + .5 * 220

this would mean you had a hit 950% of the time in l2 and 50% of the time in RAM.

This should have been: AMAT = .9 * 1 + .095 * 20 + .005 * 220

be careful about your percentages.

$\endgroup$
1
  • 1
    $\begingroup$ Welcome to COMPUTER SCIENCE @SE. While your observations are true, your interjection does not answer a) What is a two-level cache system? or b) how to calculate the time required [for the average memory access]?. $\endgroup$
    – greybeard
    Aug 5, 2021 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.