What happens when there is a cache miss?

cache misses : http://en.wikipedia.org/wiki/CPU_cache

A cache miss on an instruction fetch requires that the processor ``stall'' or wait until the instruction is available from main memory.

A cache miss on a data read may be less serious; instructions can, in principle, continue execution until the data to be fetched is actually required. In practice, data is used almost immediately after it is fetched.

A cache miss on a data word write may be even less serious; if the write is buffered, the processor can continue until the write buffer is full. (Often the write buffer is only one word deep.)

If we know the miss rate for reads in a cache memory, we can calculate the number of read-stall cycles as follows:

displaymath8478

For writes, the expression is similar, except that the effect of the write buffer must be added in:

displaymath8480

In many cache memory systems, the penalties are the same for a cache read or write. Here we can use a single miss rate, and miss penalty:

displaymath8482

Example:

Assume a cache ``miss rate'' of 5%, (a ``hit rate'' of 95%) with cache memory of 20ns cycle time, and main memory of 150ns cycle time. We can calculate the average cycle time as

displaymath8484

The following table shows the effective memory cycle time as a function of cache hit rate for the system in the above example:

Cache hit %Effective cycle time (ns)
8046
8539.5
9033
9526.5
10020

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值