Chapter 26. Memory-Mapped Files

Chapter 25, "Shared Memory," showed how shared memory could be used to share information between processes. A more modern feature of the UNIX kernel permits memory to be mapped to a regular file or a character device. This technique allows unrelated processes to share information as well, but adds a number of new features to the programmer's repertoire.

All executable files under modern UNIX kernels are mapped to virtual memory pages. These pages of memory are marked as being executable only within the process memory (on many platforms, this often implies that they are readable as well). In this manner, only those memory pages needed are actually paged into memory upon demand. For large programs, this is more efficient ...

Get Advanced UNIX Programming 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.