I/O performance recommendations

The key point when performing I/O is realizing that the underlying storage (disk) hardware is much, much slower than RAM. So, devising strategies to minimize going to the disk and working more from memory will always help. In fact, both the library layer (we have already discussed studio buffering in some detail), and the OS (via the page cache and other features within the block I/O layers, and, in fact, even within modern hardware) will perform a lot of work to ensure this. For the (systems) application developer, a few suggestions to consider are made next.

If feasible, use large buffers (to hold the data read or to be written) when performing I/O operations upon a file—but how large? A good rule of thumb ...

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.