You can just suspend processes

I came to the realization that you can just suspend processes on Linux:

sudo mkdir /sys/fs/cgroup/frozen_firefox
pgrep firefox | sudo tee /sys/fs/cgroup/frozen_firefox/cgroup.procs
# freeze the process:
echo 1 | sudo tee /sys/fs/cgroup/frozen_firefox/cgroup.freeze
# 0 for unfreeze

This completely stops the process (thanks cgroups![1]) and is trivially undone. Firefox seems to resume correctly even when frozen for extended periods of time. It turns out this is also the same flag powering docker pause.

Perhaps a "freeze when not focused for X amount of time" feature could be added to a desktop environment? I'd imagine someone has done it before.

In a similar fashion, although more hacky and not very useful, you can push a process' memory into swap by asking the kernel to reclaim it, to varying effectiveness:

echo "10G" | sudo tee /sys/fs/cgroup/frozen_firefox/memory.reclaim

This was able to move just 70MB of a live Firefox process into swap, frozen or not.


  1. cgroups stands for control groups. Also, the example is not perfect. If you have multiple Firefox processes, you should put them all in the group, otherwise only the one you put in there will be frozen. ↩︎

Published on 24 May, 2026