SA
Skip to main content

Cache Average Access Time

  • HH is the hit rate of cache level LiL_i
  • TiT_i is the access time of level LiL_i
  • RiR_i is the burst rate per word of level LiL_i (after startup access time)
  • BB is the block size

TaverageT_\text{average} with L1L_1 cache

Then there are two possible cases.

  • We have a hit and only pay L1L_1 cache time.
  • We miss and read the whole block to L1L_1

Therefore, Average Access Time TaverageT_\text{average} is (Hit Time) T1T_1 + (Miss Ratio) (1H1)(1-H_1) × (Miss Penalty) (Tmain memory+B×Rmain memory)(T_\text{main memory} + B \times R_\text{main memory})

Taverage=T1+(1H1)×[Tmain memory+B×Rmain memory]T_\text{average} =T_1 + (1-H_1) \times [T_\text{main memory} + B \times R_\text{main memory}]

TaverageT_\text{average} with L2L_2 cache

  • Hit at L1L_1 cache
  • Hit at L2L_2 cache
  • We miss and read the whole block from memory

Similarly,

Taverage=T1+(1H1)×H2×[T2+B×R2]+(1H1)×(1H2)×[T2+Tmain memory+B×Rmain memory]T_\text{average} =T_1 + (1-H_1) \times H_2 \times [T_2 + B \times R_2] + (1-H_1) \times (1-H_2) \times [T_2 + T_\text{main memory} + B \times R_\text{main memory}]