Process address space
The following diagram depicts the layout of a typical process address space in Linux systems, which is composed of a set of virtual memory segments:
Each segment is physically mapped to one or more linear memory blocks (made out of one or more pages), and appropriate address translation records are placed in a process page table. Before we get into the complete details of how the kernel manages memory maps and constructs page tables, let's understand in brief each segment of the address space:
- Stack is the topmost segment, which expands downward. It contains stack frames that hold local variables and function parameters; a new frame is created on top of the stack upon entry into a called function, and is destroyed when the current function returns. Depending on the level of nesting of the function calls, there is always a need for the stack segment to dynamically expand to accommodate new frames. Such expansion is handled by the virtual memory manager through page faults...