Cache: Average Access Time
Since we discussed cache, we can now talk about finding another type of average memory time that takes the existence of the cache into account. To calculate it, we need to know (1) the normal average memory access time (which we calculated on slide 26), (2) the time it takes to access cache, and (3) the cache hit rate on a scale from $0$ to $1$ (the fraction of cache accesses in which we succeed in finding a variable.)
Examples:
- If the normal average memory access time is $200$ ns, the cache access time is $5$ ns, and the cache hit rate is $99\%$, then the average access time would be $0.99 \cdot 5 + (1 - 0.99) \cdot (5 + 200) = 4.95 + 2.05 = 7$ ns.
- If the normal average memory access time is $50$ ns, the cache access time is $4$ ns, and the cache hit rate is $90\%$, then the average access time would be $0.90 \cdot 4 + (1 - 0.90) \cdot (4 + 50) = 3.6 + 5.4 = 9$ ns.