Memory Management
Virtual memory, page cache, OOM killer, swap, huge pages, and container memory limits.
Overview
Linux uses a virtual memory system where every process sees a flat 64-bit address space. Physical RAM is managed in 4 KB pages. The Process Virtual Address Space figure shows how that space is laid out, from the stack at the top to the program's code at the bottom.
Page Cache
The page cache is the kernel's disk cache, and Linux deliberately keeps almost no RAM truly idle. free -h shows buffers and cached columns. The available figure, not free, is the realistic estimate of how much memory new processes can use.
Key concepts
- Page cache
- OOM killer
- Anonymous vs file-backed pages
- Transparent Huge Pages (THP)
- cgroup memory limit
Interview questions
- Your Java application in Kubernetes keeps getting OOMKilled. How do you diagnose and fix it?
- What is the Linux OOM killer and how do you control which process it kills?
Sign up free to read the full topic
More Linux topics
Start free on Cariara · Coding problems · System design studio