DIO and AIO
A significant downside of using both the blocking [p]read[v](2) / [p]write[v](2) APIs as well as the mmap(2) (actually much more so with the mmap) is this: they depend on the kernel page cache always being populated with the file's pages (that it's working upon or mapping). If this is not the case—which can happen when the data store is much larger than RAM size (that it, files can be enormous)—it will result in a lot of meta-work by the kernel memory management (mm) code to bring in pages from disk to page cache, allocating frames, stitching up page table entries for them, and so on. Thus, the mmap technique works best when the ratio of RAM to storage is as close to 1:1 as possible. When the storage size is much larger than the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access