Confessions of a Code Addict
Read post

Virtual Memory: A Deep Dive into Page Tables, TLBs, and Linux Internals

A comprehensive ~25,000-word deep dive into virtual memory covering the full stack from first principles to Linux internals. Uses a narrative dialogue format between a process (Alloca) and the Kernel to explain: why virtual memory exists, virtual address space layout (text/data/BSS/heap/stack segments), hierarchical 4-level page tables (PGD/PUD/PMD/PTE) on x86-64, MMU and TLB mechanics, demand paging and page faults, VMAs vs page table entries, memory protection via permission bits (W^X), anonymous vs file-backed memory, memory overcommit and the OOM killer, copy-on-write, mmap, NUMA topology, and performance implications for data-intensive workloads. Includes observability commands for inspecting RSS/PSS, TLB behavior, and NUMA placement on Linux.

    #performance#linux
May 10•2h 3m read time•From blog.codingconfessions.com
Post cover image
Table of contents
How to Read This ArticleThe Need for Virtual MemorySize of Virtual MemoryThe Virtual Memory Address Space LayoutHow are Virtual Addresses Translated to Physical AddressesMemory Protection via Permission BitsDemand PagingWhen Physical Memory Runs Out: Swap and the Dual Meaning of the Present BitCopy-on-Write and ForkMemory-Mapped FilesAnonymous, File-Backed, and Shared MemoryPage Reclaim: How the Kernel Chooses What to EvictMemory Access Patterns and VM PerformanceHuge Pages and TLB EfficiencyTLB Shootdowns on Multi-Core SystemsNUMA (Non-Uniform Memory Access): The Physical Topology of MemoryObserving Virtual Memory in PracticeWhat We’ve Learned
55.9K Impressions1 Comment
Confessions of a Code Addict's image
Confessions of a Code Addict

Code Confessions is a platform or blog where developers share their experiences, challenges, and ins...

26 Followers

•

341 Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard