The PostgreSQL instance on a busy production server is repeatedly being terminated. Kernel messages show:
Out of memory: Kill process 13847 (postgres) score 965 or sacrifice child Killed process 13847 (postgres) total-vm:816244kB, anon-rss:512304kB, file-rss:908kB
You verify that PID 13847 is the critical backend that must remain running. You want to stop the OOM killer from choosing this one process again, yet still allow the kernel to free memory by killing less-important tasks if necessary. Which single command, run as root and without rebooting, accomplishes this goal?
Writing the value -1000 to /proc//oom_score_adj assigns the minimum possible badness score to that task. A score of -1000 makes the process ineligible for OOM selection, effectively protecting it while leaving normal OOM behavior for every other task. Setting vm.oom_kill_allocating_task merely changes which task is killed, not whether a given process is protected. Adjusting vm.swappiness only influences how aggressively the kernel swaps and has no direct effect on OOM selection. Setting vm.overcommit_memory to 2 disables memory overcommit but does not immunize an already running process from the OOM killer; it may even cause failures earlier. Therefore the only command that meets the requirement is writing -1000 to /proc/13847/oom_score_adj.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the OOM killer in Linux?
Open an interactive chat with Bash
What does setting oom_score_adj to -1000 do?
Open an interactive chat with Bash
How does vm.overcommit_memory influence OOM behavior?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Troubleshooting
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access