liveBook · Manning

Address space

As explained in Latency

A process address space is the range of virtual memory addresses available to a running process.

A process address space is the range of virtual memory addresses available to a running process. Applications allocate ranges in this virtual space, while the CPU and operating system map its pages to physical memory. section 7.4.3 section 7.4.4

The address space is divided into pages, commonly 4 KiB and sometimes larger. Its sections serve different roles: executable text, initialized data, zero-initialized BSS, and dynamically changing heap, memory-mapped, and stack regions. section 7.4.3

Address-space behavior creates several important implementation consequences:

  • Virtual pages appear contiguous to the application even when their physical pages are scattered across memory. section 7.4.4
  • The operating system can allocate physical pages lazily when a thread first accesses an address, using a page fault to begin the mapping. section 7.4.4
  • Under memory pressure, pages may be unmapped from physical memory and moved to disk, making later access far slower than ordinary memory access. section 7.4.3 section 7.4.4
Figure 7.4 A process’s virtual memory address space consists of sections that serve different purposes. The text, data, and BSS sections are initialized at program startup, whereas the heap, memory-mapped region, and stack sections change dynamically at runtime (denoted with dotted lines).

Use the process memory-layout figure to distinguish startup-initialized sections from regions that grow or change during execution. section 7.4.3

Figure 7.5 A page table is a data structure the CPU uses to translate virtual memory addresses to physical addresses. A page in virtual memory does not always have a counterpart in physical memory. Instead, the OS can store a page on the disk, for example, and lazily move it to physical memory when it’s accessed.

Use the page-table figure to trace how virtual addresses translate to physical pages and how disk-backed pages can return lazily. section 7.4.4

How Latency covers it

How deep it goes
Descends from process layout to page tables, lazy allocation, page faults, swapping, and memory-versus-disk access costs.
Examples
Uses process memory-layout and page-table figures, including contiguous virtual ranges mapped to noncontiguous physical locations.
What you can do after
Evaluate latency risks by relating page mappings, lazy allocation, and disk-backed pages to access cost.
How it connects
Connects address space to virtual memory, physical memory, page tables, pages, demand paging, and process memory sections.

Also explained in

Compare how 3 books explain address space →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Latency. The section links point to the parts of the book it draws on.