api: YAML JSON TOON Database version: 1.0.0 format: json dataset: slug: memory-management title: Memory Management description: Techniques for allocating and protecting memory. summary: "The core ideas of operating-system memory management: paging and segmentation, virtual memory and page faults, and the mechanisms that make them fast or slow, including page tables, the TLB, replacement policies, copy-on-write and fragmentation." use_when[2]: You are explaining how a process gets its address space or why a program slows down under memory pressure.,You need the difference between internal and external fragmentation. caveats[2]: Terminology varies slightly across systems (swap space versus page file) while the concepts are the same.,Numbers such as page size depend on the hardware; common values are 4 KiB with larger huge pages. related[3]: process-management,file-systems,deadlock-handling category: Operating Systems category_slug: operating-systems tags: "os,memory,paging,virtual-memory" view_count: 0 entry_count: 17 fields[2]{section,field,type,example}: data,term,string,Paging data,description,string,Divide physical memory into fixed-size frames a… data[17]{term,description}: Paging,Divide physical memory into fixed-size frames and logical memory into pages. Segmentation,Divide memory into variable-sized segments based on logical units. Virtual Memory,"Abstraction giving each process a large, isolated address space." Page Fault,Interrupt raised when a process accesses a page not in physical memory. Thrashing,Excessive paging caused by insufficient physical memory. Swapping,Moving entire processes between main memory and disk. Memory Management Unit,Hardware translating virtual addresses to physical addresses. Page Table,A per-process data structure mapping virtual pages to physical frames. Translation Lookaside Buffer,A small hardware cache of recent virtual-to-physical translations that avoids walking the page table on every access. Demand Paging,Loading a page into memory only when it is first accessed. Page Replacement,"Choosing which page to evict when memory is full; policies include FIFO, LRU and clock approximations." Copy-on-Write,"Sharing pages between processes until one writes, then copying only that page, which makes fork cheap." Memory-Mapped File,"Mapping a file into the address space so it is accessed like memory, with the OS handling the I/O." Internal Fragmentation,Wasted space inside an allocated block that is larger than needed. External Fragmentation,Free memory split into pieces too small to satisfy a request even though the total would suffice. Working Set,The set of pages a process actively uses over a window of time; keeping it in memory avoids thrashing. Kernel Space and User Space,"Memory regions that separate privileged kernel code from unprivileged programs, enforced by hardware protection."