cpulimit is a handy tool that helps you manage how much CPU power a process can use. Instead of just counting time, it looks at the actual percentage of CPU usage. This is super useful for keeping batch jobs from hogging all your resources.
The cool thing about cpulimit is that it doesn’t mess with nice values or other scheduling things. It focuses solely on real CPU usage and adjusts itself based on what’s happening with the system load. That means it can react quickly to changes!
Requirements:
You can download cpulimit here. It comes under the GPL license. Once you've got it, unzip and compile it like this:
$ tar zxf cpulimit-1.0.tar.gz
$ cd cpulimit-1.0
$ make
Your executable will be named cpulimit
.
If you want to limit a program called 'bigloop' to 40% CPU, you can run:
$ ./cpulimit --exe bigloop --limit 40
You can also use the full path:
$ ./cpulimit --path /usr/local/bin/bigloop --limit 40
If you're going by PID, here's how you'd limit it to 55%:
$ ./cpulimit --pid 2960 --limit 55
If you've got just one processor, it's straightforward—set your limit from 0% to 100%. But if you're running four processors? Well then your limits go from 0% up to 400%. So limiting at 200% means using half of what’s available!
You should run cpulimit
as the same user who runs the controlled process for best results; however, running as root gives you more precision.
A little heads up: right now cpulimit does not control children processes or threads of the original process. I know this is a limitation and I'm working on adding that feature!
Go to the Softpas website, press the 'Downloads' button, and pick the app you want to download and install—easy and fast!
SoftPas is your platform for the latest software and technology news, reviews, and guides. Stay up to date with cutting-edge trends in tech and software development.
Subscribe to newsletter
© Copyright 2024, SoftPas, All Rights Reserved.