内存访问时间对于缓存中命中的读操作为 1 纳秒,对于缓存中未命中的读操作为 5 纳秒,对于缓存中命中的写操作为 2 纳秒,对于未命中的写操作为 10 纳秒在缓存中。指令序列的执行涉及 100 次取指令操作、60 次内存操作数读取操作和 40 次内存操作数写入操作。缓存命中率为 0.9。执行指令序列的平均内存访问时间(以纳秒为单位)是 __________。
(一) 1.26
(乙) 1.68
(三) 2.46
(四) 4.52答案:(乙)
解释:
The question is to find the time taken for,
"100 fetch operation and 60 operand red operations and 40 memory
operand write operations"/"total number of instructions".
Total number of instructions= 100+60+40 =200
Time taken for 100 fetch operations(fetch =read)
= 100*((0.9*1)+(0.1*5)) // 1 corresponds to time taken for read
// when there is cache hit
= 140 ns //0.9 is cache hit rate
Time taken for 60 read operations = 60*((0.9*1)+(0.1*5))
= 84ns
Time taken for 40 write operations = 40*((0.9*2)+(0.1*10))
= 112 ns
// Here 2 and 10 the time taken for write when there is cache
// hit and no cahce hit respectively
So,the total time taken for 200 operations is = 140+84+112
= 336ns
Average time taken = time taken per operation = 336/200
= 1.68 ns
这个问题的测验