Chapter 12. Shared Memory Virtual Filesystem

Sharing a region of memory backed by a file or device is simply a case of calling mmap() with the MAP_SHARED flag. However, there are two important cases where an anonymous region needs to be shared between processes. The first is when mmap()with MAP_SHARED is used without file backing. These regions will be shared between a parent and child process after a fork() is executed. The second is when a region is explicitly setting them up with shmget() and is attached to the virtual address space with shmat().

When pages within a VMA are backed by a file on disk, the interface used is straightforward. To read a page during a page fault, the required nopage() function is found in vm_area_structvm_ops. To ...

Get Understanding the Linux® Virtual Memory Manager now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.