Roadmap › How Computers Work — CPU, Memory, OS, Processes and Threads › Module: Memory
Lessons in this course (11)
5. Virtual memory, paging and memory management by the OS
Intermediate★ Must knowLesson 5 of 11
Each process sees its own virtual address space (e.g. 128 TB on 64-bit Windows/Linux). The OS and CPU (MMU) translate virtual addresses to physical RAM in fixed-size pages (usually 4 KB).
- Isolation: one process can't read another's memory → security and stability.
- Overcommit: processes can reserve more than physical RAM; pages are loaded only when touched.
- Page fault: accessing a page not in RAM → the OS loads it (from the page file/swap or the executable on disk). Too many = thrashing (system becomes extremely slow).
- Memory-mapped files: a file mapped into memory; reading memory reads the file (used by databases and the .NET loader).
Terms you see in Task Manager / monitoring:
| Term | Meaning |
|---|---|
| Working set | Pages of the process currently in physical RAM |
| Private bytes / commit | Memory the process has committed for itself (heap, stacks) |
| Virtual size | All reserved address space (often huge, mostly unused) |
| Page file / swap | Disk area used when RAM is full |
Interview tip: "Memory leak in a managed app" usually means objects are still referenced (static lists, event handlers, caches without limits), so the GC is not allowed to free them — the OS sees private bytes grow until out-of-memory or the container is killed.