There's more...

CPU access data alignment is also crucial for efficiently mapping memory through a hardware address translation mechanism. Modern operating systems operate 4 KB memory blocks or pages to map a process' virtual address space to physical memory. Aligning data structures on 4 KB boundaries can lead to performance gains.

The same technique we described in this recipe can be applied to align data to the memory page boundaries. Note, however, that posix_memalign may require twice as much memory than what was requested to fulfill this request. This memory overhead growth may be significant for larger alignment blocks.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.98.71