質問

When I was looking at the memory latency curve generated by lmbench(e.g.,https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/Untangling%20memory%20access%20measurements%20-%20memory%20latency), I was wondering how the array size affects its exact allocation place.

My current guess is that an array of 100KB will be allocated in cache, while an array of 80MB will be allocated in main memory. If this is not true, i.e., the array of size 100KB also gets initialized in main memory, its latency will certainly be equal to the main memory latency, then there should be no latency rises in the curve.

I just want to make sure if my guess is correct or something is wrong with my understanding of memory latency.

役に立ちましたか?

解決

Both arrays will be allocated in "main memory" - they have to have real addresses after all. The difference just comes in accesses - since you're unlikely to have 80 MB of cache, iterating over the larger array causes a bunch of cache misses that never happen with the smaller array.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top