Skip to content
TaeyoungKim.dev

Memory vocabulary: stack, heap, paging, page fault, and thrashing

CSWritten 4 min readTaeyoungKim
LinkedInX

A page fault does not automatically mean a program bug. It is an exception raised when a referenced virtual page needs operating-system handling; a valid page may be brought into memory. Too many faults and replacements can contribute to thrashing, where paging work crowds out useful execution. Keep program regions such as stack and heap separate from paging's address-management units.

Core words

The diagram connects different concepts without treating them as synonyms: stack and heap describe typical allocation regions, while page faults arise during virtual-memory access.

English termMeaning and use
memory leakMemory remains allocated or reachable after an application no longer needs it, potentially raising usage or exhausting capacity.
Garbage collectionAutomatic reclamation of objects a runtime determines are no longer reachable; it does not prevent every form of retained-memory leak.
heapA region commonly used for dynamically allocated data whose lifetime need not match a function call.
stack memoryMemory commonly used for call frames, including return information and some local values; exact layout depends on language and compiler.
Boundary registerA historical hardware protection register used with address bounds to limit a process's accessible memory range.
overlayA historical technique that loads only the required portion of a program into limited main memory at a time.
PagingVirtual-memory management using fixed-size pages and physical frames for address translation and replacement.
SegmentationDividing an address space into logical regions or segments, often of varying sizes, rather than equal-sized pages.

Words to distinguish together

English termMeaning and use
OPT (Optimal Page Replacement)A theoretical policy that evicts the page used furthest in the future; it is a comparison baseline because future accesses are unknown.
Page faultA processor exception for a virtual-memory access needing OS handling. A valid nonresident page can be loaded; an invalid access becomes an error.
LRULeast Recently Used: evict the item not used for the longest time; recency, not frequency, is the criterion.
LFULeast Frequently Used: evict the least-used item by count; frequency, not the last-use time, is the criterion.
reference bitA page-table or hardware-maintained indicator that a page has been accessed, useful to replacement approximations.
modified bit/dirty bitAn indicator that a resident page has changed; a clean page usually needs no write-back of its contents on eviction.
LocalityThe tendency for accesses to cluster in time or nearby addresses rather than spread uniformly across all memory.
Temporal localityRecently accessed data or instructions are likely to be accessed again soon.

Words encountered in memory analysis

English termMeaning and use
Spatial localityAccess to one address makes nearby addresses more likely to be accessed soon.
Working setThe pages a process actively references during a chosen time window; its size helps reason about memory pressure.
PrepagingBringing pages into memory before a fault requests them, based on an expectation of future use.
ThrashingExcessive page faults and replacement consume so much time that useful work slows sharply.
Base registerA historical address-translation or relocation register holding a base address to which offsets are added.
Page tableA structure mapping virtual pages to physical frames or recording other page state needed for address translation.

A passage from a performance report

A page fault is not always a crash: a valid page may simply need to be loaded. Frequent faults and replacement, however, can indicate severe memory pressure.

When diagnosing a slowdown, separate the question “where does this program allocate data?” from “which virtual pages are resident?” An LRU discussion is about replacement policy; a memory leak discussion is about retained allocations. Either can affect memory use, but they are different causes.

Key takeaways

Follow the sequence allocation region → virtual page → fault handling → replacement → performance. Stack and heap are allocation concepts; Paging and the Page table govern virtual addresses. LFU counts uses, LRU tracks recency, and thrashing describes the cost when page movement overwhelms useful work.

Author

TaeyoungKim

Connecting technical foundations with implementation, verification, and production decisions.

#Developer vocabulary#memory management#stack#heap#paging

Read next