【发布时间】:2015-05-25 16:12:27
【问题描述】:
Here is the question:
考虑一个具有高速缓存、主内存 (RAM) 和磁盘的计算机系统,并且操作系统使用虚拟内存。从缓存中访问一个字需要 2 纳秒,从 RAM 中访问一个字需要 10 纳秒,从磁盘中访问一个字需要 10 毫秒。如果缓存命中率为 95%,主存命中率(缓存未命中后)为 99%,访问一个单词的平均时间是多少?
Here is how I solved it.
consider 100 references
95 cache hits(due to 0.95 cache hit ratio)
95*2nsec = 190 nsec
this would leave 5 references which were passed to memory
`5*0.99=4.95=5` successfully found in memory
this would count for
5*10nsec=50nsec
average access time=total time/total accesses
=(50+190)/100 nsec
=240/100 nsec
=2.4 nsec
这是正确的吗?
这是另一个解决方案
memory access time
=cache hit ratio * cache access time + (1 - hit ratio) * miss penalty(or memory access time)
=0.95*2+(1-0.95)10
2.4 nsec
哪一个是这个问题的完美解决方案?
还给出了有问题的内存命中率,但未在我在第二个解决方案中使用的公式中使用。是否在问题中不必要地给出了? 如果存在缓存命中率为 85%,内存命中率为 5%,磁盘命中率为 10% 的问题,那么这种情况下的未命中惩罚是多少?
【问题讨论】:
-
'我在互联网上搜索了很多,但找不到'-自动 DCV :(
-
@Martin 什么是自动 DCV?
标签: caching memory operating-system