How is the alignment of the physical memory guaranteed?

醉酒当歌 提交于 2020-05-15 04:57:07

问题


malloc() returns a memory suitably aligned for any in-built type. In cases where more specific alignment is required (like 16 or 32 bytes) it can be done at the application level. But this alignment is at the virtual memory level.

How is it guaranteed that the underlying physical memory is also at the same alignment ?


回答1:


Virtual memory is implemented at the page level, so every VM page maps to a physical memory page when it's loaded into memory. So everything more finely grained than the page will also be aligned equivalently between virtual and physical memory.



来源:https://stackoverflow.com/questions/26579441/how-is-the-alignment-of-the-physical-memory-guaranteed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!