Address translation and page faults
medium 7 minA virtual address identifies a location inside one process.
Video lesson · Chapter 1 of 4
A warm process touches a new working set
Theory
Read or listen first. About 2 min.
What it is
A virtual address identifies a location inside one process. Hardware caches recent translations in the TLB and walks page tables on a miss. A missing or disallowed mapping can cause a fault that enters the kernel. Some faults need only local bookkeeping or a zero-filled page, while others must wait for backing data to be read.
Why it exists
A service maps a large file and starts serving immediately. Mapping returns quickly, yet the first few requests take much longer. Align the latency spike with major faults and storage reads for that process. TLB misses and page faults count different events. Warming the hot range costs startup time and can evict useful pages elsewhere.
A warm page table can still suffer TLB misses. Flat major faults with high CPU time shift the investigation away from cold disk reads.
A warm process touches a new working set
Inside this chapter
- Virtual vs. Physical addressing
- A virtual address identifies a location in an address space. Different processes can use the same virtual address for different physical pages, or map a shared page at different addresses.
- The Memory Management Unit (MMU)
- The MMU applies mappings and access permissions for memory references. A failed permission check enters the kernel even if the page is already physically resident.
- Translation Lookaside Buffer (TLB) hits and misses
- A TLB caches address translations. A miss may require a hardware or software page-table walk. It need not cause an operating-system page fault.
- Page Tables and Page Walking
- Multi-level page tables allocate intermediate structures as needed for mapped ranges. Large sparse address spaces can therefore be cheaper than a flat entry per virtual page.
- Kernel Address Space Layout
- Kernel mappings and user mappings have different access rights. Their layout and separation depend on the architecture and kernel configuration, so virtual size alone says little about usable RAM.
- Memory Zones: DMA, Normal, HighMem
- Linux memory zones reflect addressability and hardware constraints. A request for a constrained zone may experience pressure even when other memory remains free.
How it works
Step through the idea, or press Play.
Produce an address. The instruction references a virtual page plus a byte offset.
Understand it
Worked incident
A warm process touches a new working set
| Observation | Major faults per interval (faults) | Interpretation |
|---|---|---|
| Baseline | 1 | The serving range is already resident. |
| Incident | 84 | Requests touch cold file pages and storage reads follow. |
| After intervention | 3 | Warm the bounded hot range before accepting traffic. Compare first-request latency after a cold restart. |
Choose the next investigation
Summary
The whole topic in one minute.
Translation can be recovered by walking resident page tables. Disk-backed fault handling is a separate operation.
A warm page table can still suffer TLB misses. Flat major faults with high CPU time shift the investigation away from cold disk reads.