A system has two levels of cache. The L1 cache has a hit rate of 95%, and the L2 cache has a hit rate of 90%. The L1 access time is 2 ns, L2 access time is 10 ns, and main memory access time is 100 ns. What is the average memory access time (AMAT)?
Deepseek.
To calculate the Average Memory Access Time (AMAT) for a system with two levels of cache (L1 and L2), we need to consider the hit rates and access times of each cache level, as well as the access time for the main memory. Here's a step-by-step breakdown:
Given:
- L1 Cache:
- Hit Rate (HL1HL1) = 95% or 0.95
- Access Time (TL1TL1) = 2 ns
- L2 Cache:
- Hit Rate (HL2HL2) = 90% or 0.90
- Access Time (TL2TL2) = 10 ns
- Main Memory:
- Access Time (TmemTmem) = 100 ns
Understanding the Cache Hierarchy:
- L1 Cache:
- When the CPU requests data, it first checks the L1 cache.
- If the data is found in L1 (L1 hit), the access time is TL1TL1.
- If the data is not found in L1 (L1 miss), the system proceeds to check the L2 cache.
- L2 Cache:
- Upon an L1 miss, the system checks the L2 cache.
- If the data is found in L2 (L2 hit), the total access time is TL1+TL2TL1+TL2.
- If the data is not found in L2 (L2 miss), the system must access the main memory.
- Main Memory:
- Upon an L2 miss, the system fetches the data from the main memory.
- The total access time in this case is TL1+TL2+TmemTL1+TL2+Tmem.
Calculating AMAT:
The AMAT can be calculated using the following formula:

Let's break this down:
- L1 Hit:
- Probability: HL1HL1
- Access Time: TL1TL1
- L1 Miss and L2 Hit:
- Probability: (1−HL1)×HL2(1−HL1)×HL2
- Access Time: TL1+TL2TL1+TL2
- L1 Miss and L2 Miss:
- Probability: (1−HL1)×(1−HL2)(1−HL1)×(1−HL2)
- Access Time: TL1+TL2+TmemTL1+TL2+Tmem
Now, plug in the values: