简体   繁体   中英

mmap and page alignment of data - does this increase performance?

Is there any benefit to aligning my data in an mmap()ed file? ie if data for an object to be read is offset with a multiple of the OS'es page size from the start of the file (or mmap?).

Would this result in faster read performance because less page faults are generated and the OS doesn't have to swap data in and out. How does this work?

From reading around I have the answer.

If a small piece of data will cross the boundary of a page, it's probably better to align it with the next page as the OS loads data from the disk pages at a time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM