Linux use cpulimit limit process cpu usage rate

  

Very useful Linux may often find that somehow it becomes very slow, this time most of the background process used cpu and memory too much. How to limit the CPU usage resources of each process?

You can use cpulimit to limit the CPU usage of each process. The usage rate is expressed in hundred percent.

Installing cpulimit
Installing with source code
# cd /tmp# wget 'http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz'# tar cpulimit -1.1.tar.gz# cd cpulimit-1.1# make# cp cpulimit /usr/local/sbin/# rm -rf cpulimit*Debian /Ubuntu users

More convenient installation with apt-get
$ sudo apt-get update$ sudo apt-get install cpulimit

How to use cpulimit?

Limit firefox to 30% cpu utilization
# cpulimit -e firefox -l 30

Programs that limit process number 1313 use 30% cpu utilization
# cpulimit -p 1313 -l 30

Find pid based on process name
# ps aux |  Less# ps aux |  Grep firefox# pgrep -u vivek php-cgi# pgrep lighttpd

You can use absolute path to limit cpu utilization of processes
# cpulimit -P /opt/firefox/firebox -l 30

Single core cpu and multicore Cpu

The usage rate of single-core cpu ranges from 0% to 100%, and the usage rate of quad-core cpu ranges from 0% to 400%.

Related Tools

nice : Run the program with the specified priority

renice: Adjust the priority of the running process

Copyright © Windows knowledge All Rights Reserved