Question:

A computer has a memory hierarchy consisting of two-level cache (L1 and L2) and a main memory. If the processor needs to access data from memory, it first looks into L1 cache. If the data is not found in L1 cache, it goes to L2 cache. If it fails to get the data from L2 cache, it goes to main memory, where the data is definitely available. Hit rates and access times of various memory units are shown in the figure. The average memory access time in nanoseconds (ns) is __________. (rounded off to two decimal places) 

Show Hint

The average memory access time can be calculated by considering the hit and miss rates for each level of cache and the main memory. Multiply the hit rate by the access time for each level and then sum up the results.
Updated On: Apr 4, 2025
Hide Solution
collegedunia
Verified By Collegedunia

Solution and Explanation

We are given the following information:

L1 cache:
Hit rate = 95%
Access time = 10 ns

L2 cache:
Hit rate = 85%
Access time (including L1 cache miss penalty) = 20 ns

Main Memory:
Access time (including L1 and L2 cache miss penalty) = 200 ns

Step 1: Calculate the average memory access time

We can calculate the average memory access time using the formula:
\[ \text{Average Memory Access Time} = (\text{L1 hit rate}) \times (\text{L1 access time}) + (\text{L1 miss rate}) \times \left( (\text{L2 hit rate}) \times (\text{L2 access time}) + (\text{L2 miss rate}) \times (\text{Main memory access time}) \right) \] Let's break this down:
1. L1 access time:
The L1 cache hit rate is 95%, so the L1 miss rate is \( 1 - 0.95 = 0.05 \).
The L1 access time is 10 ns.

2. L2 access time:
The L2 cache hit rate is 85%, so the L2 miss rate is \( 1 - 0.85 = 0.15 \).
The L2 access time (including L1 cache miss penalty) is 20 ns.

3. Main memory access time:
The main memory access time (including both L1 and L2 cache miss penalties) is 200 ns.

Step 2: Plugging in the values

Now, we can substitute the given values into the formula:
\[ \text{Average Memory Access Time} = 0.95 \times 10 + 0.05 \times \left( 0.85 \times 20 + 0.15 \times 200 \right) \] First, calculate the inner part:
\[ 0.85 \times 20 = 17, \quad 0.15 \times 200 = 30 \] Now substitute these values:
\[ \text{Average Memory Access Time} = 0.95 \times 10 + 0.05 \times (17 + 30) = 9.5 + 0.05 \times 47 = 9.5 + 2.35 = 11.85 \text{ ns} \] Final Answer:
Thus, the average memory access time is \( \boxed{11.85} \) ns.
Was this answer helpful?
0
0

Top Questions on Memory hierarchy

View More Questions