Skip to main content
InterviewHubPRO
Section Overview
Q13

Question 13 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

26%
Linux OS Internals (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What is the Linux Out-Of-Memory (OOM) Killer and how does it choose victims?

senior LevelSystem Design

In Simple Words: Linux employs Memory Overcommit: it allows processes to allocate more virtual memory than physical RAM exists, betting that processes will not use all allocated RAM simultaneously:

  • When physical RAM and swap are completely exhausted, the kernel invokes the OOM Killer to prevent an OS kernel panic.
  • Algorithm: Inspects /proc/[pid]/oom_score (0 to 1000).
  • Kills the process with the highest score (typically the rogue process consuming the most RAM that has the lowest system impact).
  • Protecting Critical Services: Set echo -1000 > /proc/[pid]/oom_score_adj to make databases (PostgreSQL/MySQL) immune to OOM killer.