Quiz: Linux Memory Management¶
6 questions
L1 (3 questions)¶
1. What does the OOM killer do and how does it choose which process to kill?
Show answer
The OOM (Out Of Memory) killer terminates processes when the system runs out of memory. It scores processes based on memory usage, oom_score_adj, and other factors — the highest-scoring process is killed first. *Common mistake:* It swaps all processes to disk2. Why does Linux show very little 'free' memory even when the system is not under load?
Show answer
Linux aggressively uses free memory for disk cache (buffer/cache). This memory is reclaimable — the kernel releases it immediately when applications need it. The 'available' column in free -h shows truly usable memory. *Common mistake:* The kernel has a memory leak3. What does 'free -h' show in the buff/cache column and why is it important?
Show answer
buff/cache shows memory used for disk I/O buffers and file page cache. This is reclaimable memory that speeds up disk reads. The 'available' field = free + reclaimable cache, which is the real measure of usable memory. *Common mistake:* It shows memory used by running applicationsL2 (3 questions)¶
1. What is the difference between RSS and VSZ in ps output?
Show answer
RSS (Resident Set Size) is the physical memory currently in use by the process. VSZ (Virtual Size) is the total virtual address space, including mapped-but-not-loaded pages, shared libraries, and swap. RSS ≤ VSZ. *Common mistake:* RSS includes swap space usage2. What is vm.swappiness and how does changing it affect system behavior?
Show answer
vm.swappiness (0-200, default 60) controls how aggressively the kernel swaps anonymous pages vs. reclaiming page cache. Lower values prefer keeping application memory in RAM; higher values allow more swapping. Setting 0 does not disable swap. *Common mistake:* Setting swappiness to 0 disables swap completely3. Explain the difference between anonymous memory and file-backed memory in Linux.