*$h_1→L1$ hit ratio
*

$h_2→L2$ hit ratio

$C_1→ L1$ access time

$C_2→ $Miss penalty to transfer information from L2 to L1

$M→$ Miss penalty to transfer information from main memory to L2

*Average access time given in Carl Hamacher's book is*

*$t_{avg}=h_1C_1+(1-h_1)h_2C_2+(1-h_1)(1-h_2)M$*

*Shouldn’t it be*

*$t_{avg}=h_1C_1+(1-h_1)h_2(C_2\color{red}{+C_1})+(1-h_1)(1-h_2)(\color{red}{C_1+C_2’+C_2+}M)$*

where $C_2’\rightarrow$ L2 access time (note that this is different from $C_2$)

When L2 miss occurs, book formula considers only $M$, that is moving data from memory to L2. Isnt this data also moved from L2 to L1 making us add $C_2$? Also $C_2$ and $M$ are duration for moving data from L2 to L1 and memmory to L2 respectively. These are penalties. But before penalties, a miss occurs which requires $C_1$ time for L1 miss and $C_2’$ time for L2 miss. But these does not seem to have added in the book formula. I have added them as highlighted in red.

Is my equation correct or book’s equation. Or something more is going on here, which I am unaware of?