An array is cache-aligned:
- The size of each array element matches the size of the cache block.
- The starting address of the array is a multiple of the cache block size.
Let's elaborate on these points:
- Array Element Size Matches Cache Block Size
If each element of the array is exactly the size of a cache block, then each access to an element of the array aligns perfectly with the cache block. This ensures that fetching an element from the array fetches exactly one cache block, optimizing memory access patterns.
- Starting Address is a Multiple of the Cache Block Size
When the starting address of the array is a multiple of the cache block size, it means that the first element of the array is aligned with the beginning of a cache block. This alignment ensures that subsequent elements, which are cache block-sized, also align perfectly with subsequent cache blocks.
标签:缓存,cache,element,数组,each,对齐,array,block,size From: https://www.cnblogs.com/shangshankandashu/p/18306893