= Shared file mapping
{title2=MAP_SHARED}
With `MAP_SHARED`, updates are visible to other <operating-system processes> mapping the same region and are carried through to the <backing file>. With `MAP_PRIVATE`, updates instead stay private, and later <backing file> changes have unspecified visibility in that mapping.<mmap(2) — Linux manual page>[DESCRIPTION, The flags argument: MAP_SHARED and MAP_PRIVATE]{ref}
In the toy model, both <shared file mappings> initially read backing <bytes> $x=7,y=8$ at <file offsets> 8229 and 8230. Both <memory pages> have been accessed, so their translations are installed. A shared store changes the common <page cache> contents and creates a <dirty memory page> eligible for <page writeback>. That change can be observed before it reaches persistent storage. Cooperating readers need <synchronization (computing)> to know when an update is ready; `MAP_SHARED` alone supplies no <mutual exclusion> or indivisible multi-field update.
Back to article page