服用 Peter Norvig's advice ,我在思考这个问题:
How much time does it take to fetch one word from memory, with and without a cache miss?
(假设标准硬件和架构。为了简化计算,假设 1Ghz 时钟)
最佳答案
好像是 Norvig answers this himself :
execute typical instruction 1/1,000,000,000 sec = 1 nanosec
fetch from L1 cache memory 0.5 nanosec
branch misprediction 5 nanosec
fetch from L2 cache memory 7 nanosec
Mutex lock/unlock 25 nanosec
fetch from main memory 100 nanosec
send 2K bytes over 1Gbps network 20,000 nanosec
read 1MB sequentially from memory 250,000 nanosec
fetch from new disk location (seek) 8,000,000 nanosec
read 1MB sequentially from disk 20,000,000 nanosec
send packet US to Europe and back 150 milliseconds = 150,000,000 nanosec
它说“执行典型指令”= 1 ns 的部分意味着 1 GHz CPU(当然,假设有效的流水线)。
我不知道他从哪里获取这些信息,但我相信 Peter Norvig 是可靠的 :-)
关于architecture - 从内存中提取一个单词需要多长时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3142779/