Limit the CPU usage of a process with cpulimit, a user-friendly program that allocates a percentage of CPU usage. It's not based on CPU time and prioritizes stable system performance.
CPULimit should run on any Linux 2.2 or higher version. However, there may be differences in the meaning of CPU usage in SMP hardware. If you can modify the program's source code to execute it on non-Linux OS, you can notify the developer to publish your code. The only non-portable code is iterating through the process list.
To start using the program, you can download the source code under the GPL license and compile it using the given commands. After compiling, you can find the executable file as cpulimit. There are examples of how you can use the program, such as limiting the CPU usage of a program like 'bigloop' by executable name or PID to a specified percentage. The program accepts different options to enable you to control the percentage of CPU usage, verbosity, and more.
If you have multiple processors, the percentage limit can range between 0% to 400%. When you limit it to 200%, you only use half of the available power. Furthermore, CPULimit should only run with the same user running the controlled process, but it is better to run it as root for more precision. The program does not limit children, including processes and threads, at present. However, the developer is working on adding this feature.
Version 1.1: N/A