Page Fault
ELI5 - The Vibe Check
A page fault happens when your program reaches for a piece of memory that isn't actually sitting in physical RAM yet, maybe it was swapped out, maybe it's a brand new page the OS hasn't bothered to allocate until now, and the CPU has to pause and ask the operating system to go fetch or create it. Some page faults are normal and nearly free, others mean your program just hit disk and got a lot slower for a moment.
Real Talk
A page fault is a trap raised by the CPU's memory management unit when a program accesses a virtual memory page that isn't currently mapped to physical memory. Minor page faults are resolved quickly by the OS, allocating a fresh page or finding it already in the page cache, while major page faults require reading from disk, which is orders of magnitude slower and a common hidden cause of latency spikes.
When You'll Hear This
"The latency spike lined up exactly with a spike in major page faults, we were swapping." / "Pre-touching the allocated memory avoids page faults during the hot path."
Related Terms
Context Switch
A context switch is the CPU pausing whatever thread it's running, carefully saving all its progress like a bookmark, and loading up a completely different...
Latency
Latency is the delay before data starts moving — the time it takes for a request to go from your device to the server and back.
Memory Fragmentation
Memory fragmentation is what happens when your program has plenty of free memory in total, but it's scattered around in small, useless chunks instead of on...
Syscall
A syscall is your program raising its hand and asking the operating system kernel to do something it isn't allowed to do itself, like reading a file, openi...