What's the best way to accomplish this on Linux? If there is a good mechanism, can you apply it to a currently running process or do you have to pre-define available resources?
The only trick I have up my sleeve is to use earlyoom to abort misbehaving processes if I suddenly squander all of my ram.
I do remember systemd having `CPUQuota` to set an absolute limit, I am not sure if this is only limited to actual units or if this can be applied to slices as well (KDE and GNOME default to running individual desktop apps in their own slice IIRC), but from the quick glance I took on https://www.freedesktop.org/software/systemd/man/latest/syst... I think it should be possible also to do it on a per slice basis.
The only trick I have up my sleeve is to use earlyoom to abort misbehaving processes if I suddenly squander all of my ram.