【发布时间】:2020-02-02 09:18:50
【问题描述】:
During a program execution, out of 1000 memory references there are 250 and
120 misses in L1 (Level-1) and L2(Level-2)
caches respectively. Hit times for L1 and L2 cache
are 24 and 40 cycles respectively.If there are 2.5 memory references
per instruction (Assume L2 to memory miss penalty is 250 cycles).
The average stall cycles per instruction is _______.
这里我们每条指令有 2.5 个内存引用
=> 指令数 = 1000/2.5 = 400 条指令。
L1 未命中率 = 250/400
L2 的未命中率 = 120/400 或 120/250 ?
我们是否应该将L2的未命中率的分母作为指令的总数
或
指令总数 一级缓存未命中?
下面的解决方案正确吗?
【问题讨论】:
-
这是某个站点的另一个练习问题吗?如果可能的话,在你找到它的地方链接。
-
这是一个教练机构的作业题。我不确定他们给出的解决方案是否正确。我已附上解决方案和问题。
-
链接它的来源,有两个原因:人们可以看到,并且很清楚你引用的内容(出于版权原因)。
-
这是一个付费课程;因此无法共享链接;但我看到他们的解决方案有时是不正确的。上述解决方案正确吗?
-
应该是 w.r.t 指令的总数。 Miss in L1 和 Miss in L2 是互斥的,用词很草率,“Miss in L1”实际上就是“L1 中的Miss 和L2 中的命中”。根据每个内存引用的成本(例如,L1 中的 1/4 未命中,L2 中的 6/50 未命中,因此平均一个内存访问成本为 40 个周期),您得出了相同的结果(100 个周期)。我更喜欢这种方法,但这只是个人喜好问题。
标签: cpu-architecture cpu-cache