TGViewer
Linux - Reddit Linux - Reddit @r_linux · 1.03K subscribers
Post #42973 66
How shared memory actually works in Linux

Had some free time recently so I made a visual explainer on how shared memory actually works in Linux.

Normally, two processes have completely separate virtual address spaces. Process A shouldn't be able to touch Process B's memory at all.

But with shared memory, one process can write a value and another process can read it without copying the payload between them.

The video goes through virtual memory, page tables, physical frames, shm_open, ftruncate, mmap with MAP_SHARED, lazy allocation, and what actually happens when either process touches the mapping.

I also get into related mechanisms like memory-mapped files, shared libraries, copy-on-write after fork(), zero-copy IPC, and eventually Dirty COW and what can happen when these page-table tricks go wrong.

Link for anyone interested

Feedback welcome :)

https://redd.it/1vjrahk
@r_linux
YouTube Linux Processes Aren’t Always Isolated Watch More Low Level Animated Deep Dives: https://youtube.com/playlist?list=PLMXMEKvLCzsI&si=TqIoC2dz4RkibIRk 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…
More from @r_linux
  1. Sep 24, 2026Canonical is speeding up Ubuntu's kernel updates because it's drowning in AI-discovered bu…
  2. Sep 11, 2026I realized something about Linux: Close to no reboots necessary! Under Win$lop I had to re…
  3. Aug 28, 2026postmarketOS Linux booted on iPhone 6S https://redd.it/1w0vkmn @r_linux
  4. Aug 28, 2026How did you first get introduced to linux? What is your story on how you became a linux us…
  5. Aug 27, 2026Linux currently has all time high market share at 7.5%, but what exactly happened in the l…
  6. Aug 27, 2026Progress Report: Linux 7.2 - Asahi Linux https://asahilinux.org/2026/08/progress-report-7-…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →