Consider a system where Cache access time = 5 ns Main memory access time = 80…

Consider a system where

Cache access time = 5 ns
Main memory access time = 80 ns
Cache hit ratio = 0.9

Calculate the average memory access time (AMAT) and explain how increasing the hit ratio improves system performance.

Attempted by 79 students.

Show answer & explanation

Concept

The Average Memory Access Time (AMAT) measures the effective time the CPU waits for data when a fast cache backs a slower main memory. The cache is always probed first, so its access time is paid on every reference; only on a miss does the slower main memory also have to be read.

AMAT = Hit time + (Miss rate × Miss penalty)

  • Hit time = cache access time (paid on every access).

  • Miss rate = 1 − Hit ratio.

  • Miss penalty = extra time to fetch the block from main memory after a miss.

  • Access model = when a question does not state how cache and main memory are accessed, assume hierarchical (sequential) access — the cache is checked first, and main memory is read only after a miss; this is the standard default convention. (Under the less common simultaneous access model, cache and main memory are probed in parallel, so a miss costs only the memory time, giving AMAT = 0.9 × 5 + 0.1 × 80 = 12.5 ns instead — different from the 13 ns used here.)

Application

Given: cache access time = 5 ns, main memory access time = 80 ns, hit ratio = 0.9.

  1. Miss rate = 1 − 0.9 = 0.1.

  2. Miss penalty = main memory access time = 80 ns.

  3. AMAT = 5 + (0.1 × 80) = 5 + 8 = 13 ns.

Effect of increasing the hit ratio

Raise the hit ratio to 0.95, so the miss rate falls to 0.05:

  1. AMAT = 5 + (0.05 × 80) = 5 + 4 = 9 ns.

A higher hit ratio means fewer accesses pay the 80 ns main-memory penalty, so the effective access time drops (13 ns → 9 ns here) and throughput rises. This is why exploiting locality of reference — loops and array traversals reuse nearby data — keeps the hit ratio high and the system fast.

Cross-check

The same result follows from the weighted form: AMAT = hit ratio × cache time + miss rate × (cache + memory) = 0.9 × 5 + 0.1 × (5 + 80) = 4.5 + 8.5 = 13 ns, confirming the answer.

Explore the full course: Zero To Hero

Loading lesson…