# Practical way to prevent runaway process from taking over?



## sidetone (Apr 15, 2022)

There's nice(1), and renice(1) but any instructions I saw applied after a program is identified as being a runaway process. Is there a way to make a program or group be pre-determinately set to have a lower priority nice option? Adding the nice command to the menu item that launches an application could be one way. Is there another way to preset nice priority for a process group?

rctl(8) was pointed to me at https://docs.freebsd.org/en/books/handbook/security/#_enabling_and_configuring_resource_limits. This may be the way to go.

There was `hw.physmem` for `sysctl` and loader.conf to reserve memory for the kernel. Thread memmap-in-freebsd.40667. `sysctl -a` and `grep` should be useful for looking for desired values to tune.

An example of processes to preserve CPU and RAM for would be Kernel and the base system. An example of programs to limit are Firefox and Thunderbird, including by limiting their group.

What's a good method of practice? Including about nice prioritizing and limiting resources for groups the host system. For jails can be answered about too.


----------

