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_struct
→vm_ops
. To ...
Get Understanding the Linux® Virtual Memory Manager 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.