← Interview Prep

Linux Kernel — Process Address Space

A process's memory to the kernel: mm_struct & VMAs, the regions (text/data/bss/heap/mmap/stack), creating/growing them (mmap, brk, stack growth), demand paging & page faults (minor/major, anon vs file-backed, Copy-On-Write, SIGSEGV), and ASLR/hardening.

What a process's memory actually looks like to the kernel — the regions, how they're created, and how a page fault fills them in lazily. Original, interview-focused notes; the per-process side of Memory Addressing.

A process's address space is a set of memory regions (VMAs), described by an mm_struct. Nothing is really allocated up front — the kernel just records "this range is valid," and demand paging maps physical pages only when they're first touched.

mm_struct & VMAs

The regions of a program

RegionWhat
textExecutable code — file-backed, read-only, shared between processes.
data / bssInitialized / zero-initialized globals.
heapGrown by brk/sbrk; large allocations go via mmap instead.
mmap areaShared libraries, file mappings, large malloc chunks, anonymous maps.
stackGrows down on demand; a guard gap prevents collision.

Creating & growing regions

Demand paging & the page fault

Because regions are lazy, actually using memory triggers a page fault, which the kernel resolves by the VMA type:

Layout & hardening

Likely interview questions

Kernel Internals series. Related: Memory Addressing · Page Cache · Processes.