Direct I/O (DIO)
An interesting I/O technology is Direct I/O (DIO); to use it, specify the O_DIRECT flag when opening the file via the open(2) system call.
With DIO, the kernel page cache is completely bypassed, thereby immediately giving the benefit that all the issues that can be faced with the mmap technique now disappear. On the other hand, this does imply that the entire cache management is to be completely handled by the user space app (large projects such as databases would certainly require caching!). For regular small apps with no special I/O requirements, using DIO will likely degrade performance; be careful, test your workload under stress, and determine whether to use DIO or skip it.
Traditionally, the kernel handles which pieces ...
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