Linux – Slow down just one process to regulate CPU temperature

linuxprocess

  1. I have a program. When it is running, the CPU temperature raise from
    50 to 80 Celcius, which is my major concern.

    I can control the CPU frequency to slow it down, but other processes
    will be slowed down as well which I don't want.

    Is it possible to slow down a particular process without affecting
    other processes to keep the CPU cool?

    My OS is Ubuntu 10.10.

  2. I tried to set the priority of the process by nice -n 15
    myprogram
    , and am not sure if that will work. The CPU is 77 Celcius
    high.

    Does nice only set relative priority of a process wrt other
    processes? I.e., if other processes are not running, will this niced
    process run fast? I would like to set the process to be running
    slow all through.

Best Answer

CPULimit is exactly what you need. You start the program, then run cpulimit against the program name or PID, specifying what percentage you want it limited.

The following command limits the process at PID 7777 to 5% CPU usage.

cpulimit -p 7777 -l 5

Alternatively, you can use the name of the executable:

cpulimit -e myprogram -l 5

Or the absolute path of the executable:

cpulimit -P /path/to/myprogram -l 5

Note the percentage is of all cores; so if you have 4 cores, you could use 400%.

Related Question