对于具有高速缓存命中的读取操作,内存访问时间为1纳秒;对于具有高速缓存命中的读取操作,内存访问时间为5纳秒;对于具有高速缓存命中的写入操作,内存访问时间为2纳秒;对于具有未命中的写入操作,内存访问时间为10纳秒。在缓存中。指令序列的执行涉及100个指令提取操作,60个存储器操作数读取操作和40个存储器操作数写入操作。缓存命中率为0.9。执行指令序列的平均内存访问时间(以纳秒为单位)为__________。
(A) 1.26
(B) 1.68
(C) 2.46
(D) 4.52答案: (B)
解释:
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
这个问题的测验