Memory-Mapped Files
mmap() makes a file look like RAM: you read and write it with plain pointer
dereferences, and the kernel does the disk I/O behind your back. This video explains how
that illusion is built from the same page-table machinery as ordinary virtual memory,
and why it is frequently the fastest way to move file data — and occasionally the
slowest.
Topics covered:
- How
mmapwires file pages into your address space via page tables - Demand paging: the file is read lazily, page by page, on first touch
- The page cache: why mapped reads and buffered reads share the same cache
- Dirty pages: when your writes reach disk and how writeback decides
- Why mapped I/O avoids the copy
read()andwrite()always make - Shared vs. private mappings and how MAP_PRIVATE implements copy-on-write
- Trade-offs: page faults, truncation, and the SIGBUS edge case
Related articles
How Virtual Memory Works
Page tables, TLB, and demand paging — why your 16GB laptop 'has' 128GB of addressable memory.
Page Faults and Demand Paging: Why First Touch Costs
Demand paging maps memory lazily — minor faults hit the page cache while major faults hit disk — so mmap stays free until first touch and fault counters tell you why.
What Really Happens During a System Call
Trap, ring transition, and the syscall table — the cost of asking the kernel for help and why it's never free.
More in Operating Systems
Virtual Memory in One Diagram
Page tables, TLB, demand paging, and copy-on-write — how your 16GB laptop 'has' 128GB of addressable memory.
WatchContainer Isolation in Linux
What Docker and Kubernetes containers actually are — namespaces, cgroups, and the syscalls that make isolated processes without a VM.
DetailsSignals and Interrupts
Hardware interrupts and Unix signals — the two asynchronous mechanisms that interrupt your program, and what the kernel does between the wire and your handler.
DetailsLocks and Synchronization Primitives
Mutexes, spinlocks, semaphores, and condition variables — how they map to hardware atomics and futexes, and when each one is the right tool.
DetailsFile Systems Explained
How a file system stores your data — inodes, directory entries, extents, and journaling — and what actually happens on read and write.
DetailsThread Pools Explained
How thread pools work under the hood — worker threads, work queues, and why reusing threads beats spawning them for every request.
DetailsSyscalls Under the Hood
What actually happens when your program calls read(), open(), or fork() — the trap, the kernel mode switch, and the return path.
DetailsVirtual Memory Explained
Address translation, page tables, and the TLB — the full path from a virtual address to the physical RAM cell, including why the translation is cached.
DetailsProcess Scheduling, Visualized
How the Linux scheduler picks the next runnable process — time slices, priorities, CFS virtual runtime, and why your busy server still feels responsive.
DetailsDepth, delivered weekly
One technical dispatch a week — articles and episode notes before they go public.
One technical dispatch per week. No noise.