File I/O via memory mapping

Both in Appendix A, File I/O Essentials, and in this chapter, we have on several occasions mentioned how the Linux kernel's page cache helps greatly enhance performance by caching the content of files within it (alleviating the need to each time go to the really slow storage device and instead just read or write data chunks within RAM). However, though we gain performance via the page cache, there remains a hidden problem with using both the traditional read(2), write(2) APIs or even the faster SG-I/O (the [p][read|write][v][2](2)) APIs.

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.