内存对齐:内存读取粒度

Memory access granularity

Programmers are conditioned to think of memory as a simple array of bytes. Among C and its descendants, char* is ubiquitous as meaning "a block of memory", and even Java™ has its byte[] type to represent raw memory.

Figure 1. How programmers see memory

How Programmers See Memory

However, your computer's processor does not read from and write to memory in byte-sized chunks. Instead, it accesses memory in two-, four-, eight- 16- or even 32-byte chunks. We'll call the size in which a processor accesses memory its memory access granularity.

https://www.ibm.com/developerworks/library/pa-dalign/index.html

 

CPU把内存当成是一块一块的,块的大小可以是2,4,8,16字节大小,因此CPU在读取内存时是一块一块进行读取的。块大小成为memory access granularity(粒度) 本人把它翻译为“内存读取粒度” 。

http://www.cppblog.com/snailcong/archive/2009/03/16/76705.html

posted @ 2018-12-03 17:09  zzfx  阅读(1036)  评论(0编辑  收藏  举报