Sign in
← Back to feed
Operating systems kuki 1 on this track
Orkhan Huseynli @orkhanhuseynli · · 1 min read

Linux has a mechanism called OOM killer (out-of-memory killer) which is used to kill processes when the memory is critically low. It is usually triggered when a memory allocation fails or when a process hits its cgroup limit.

It turns out you can influence its decision to kill or not to kill you. It decides by a factor called badness score which you can set inside /proc/[pid]/oom_score_adj file. You can also view your process' OOM score by looking at /proc/[pid]/oom_score file. A higher oom_score_adj makes a process more likely to be killed.

For instance, as you might already know, chromium uses a separate renderer processes for each tab. Chromium sets higher oom_score_adj values for its renderer processes so that when OOM killer goes on a killing spree, it first kills the renderer processes.

React Mostly sweet
Save