How Processes Share Memory Without Copying

Two separate processes are not supposed to touch each other’s memory. So how can Process A write a value, and Process B read it instantly, with zero payload bytes copied? In this video, we look at how shared memory actually works: virtual memory, page tables, physical frames, shm_open, ftruncate, mmap with MAP_SHARED, lazy allocation, and why the bytes do not move when two processes share the same page. We also look at where this same idea shows up everywhere else: zero-copy IPC, copy-on-write fork, Redis snapshots, shared libraries like libc, and memory-mapped files. The core idea is simple: Don’t move the data. Move what points at it. And then we get to the dangerous part: what happens when the same copy-on-write machinery goes wrong, and how bugs like Dirty COW turned shared mappings and page-table tricks into a path to root. Tags: #linux #memorymanagement #systemsprogramming