Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
  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.

Thanks and regards!

share|improve this question
What does this process do: heavy input/output? Heavy calculations on the main CPU? Heavy calculations on the GPU (video card) (usually but not limited to programs that calculate images)? –  Gilles Aug 16 '11 at 22:56
The program is pdf2djvu, converting a pdf file to djvu. Is it heavy IO or heavy CPU or heavy GPU? Do you have different ways for different cases? –  Tim Aug 16 '11 at 23:04
80º is very very high. I live in a hot place of Spain and the maximus temperature of my processor is ~60º. Open the computer, clean all pieces and change the coolers. I think your isn't the CPU use. –  J.F. Aug 17 '11 at 1:22
Try doing both. –  stribika Aug 17 '11 at 13:17

2 Answers 2

up vote 7 down vote accepted

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. Note the percentage is of all cores; so if you have 4 cores, you could use 400%.

share|improve this answer
Thanks! (1) Is CPULimit only used for already run process? Not used when submitting a program to run? (2) does it fix the percentage of usage of CPU by a process, or set the upper limit for the process and allow its usage to fluctuate between 0 and that limit according to other processes? (3) I also found that after using CPULimit on a process, there is no way to Ctrl+C to cancel the running, because it will soon return back to run automatically. Wonder why? –  Tim Aug 17 '11 at 0:36
A small caveat about CPULimit: it uses SIGSTOP/SIGCONT to limit the amount of CPU time used by a process (processes exceeding the target CPU usage are stopped; when enough time has passed, the process is sent a SIGCONT and resumes execution). However, there are rare cases in which signals can interfere with system calls, see the GNU C library manual for details. Since CPULimit sends these signals many times a second, there's quite a chance of interrupting. Not a big problem for running pdftk on a desktop, tho. –  Riccardo Murri Aug 18 '11 at 21:13

You can renice a running process to give it more or less priority (the so-called "nice value"). Note that the UNIX priority scale is somewhat counter-intuitive: negative values mean a process is favored over concurrent processes, i.e., it has "more" priority.

You can thus try to "slow down" your process given its PID through:

# lower priority of a process
renice +1 "PID"

Every time you run this, the process "nice value" is raised by 1; you can use integer values other than +1 of course.

The command nice allows you to start a process with a +10 nice value adjustment (change this with option -n). For example:

# start a CPU-intensive task with low priority
nice ./cpu-hog

However, the "nice value" only affects how much the scheduler favors running a particular process over others in the system: if your computer is basically idling, raising the "nice value" of one single process will not stop that process from taking 100% CPU. I quote from the getpriority(2) manpage: (Emphasis added by me.)

The degree to which their relative nice value affects the scheduling of processes varies across Unix systems, and, on Linux, across kernel versions. Starting with kernel 2.6.23, Linux adopted an algorithm that causes relative differences in nice values to have a much stronger effect. This causes very low nice values (+19) to truly provide little CPU to a process whenever there is any other _higher priority load on the system._

The reason for this resides in the way processes are run on a UNIX-like kernel: every time the kernel decides to run a process, that process has full control of a CPU core for a certain (fixed and short) span of time. The "nice value" can influence how often the kernel scheduler is willing to give a time slot to a process, but you cannot change the fact that, once scheduled, a process runs undisturbed for a fixed amount of time.

Therefore, short of slowing down your CPU there is no way to make a process run slower if there are no other processes in the system that can contend for CPU access.

share|improve this answer
Thanks! Is it possible to make a process run slow from the beginning till the ending, regardless of other processes? –  Tim Aug 16 '11 at 23:09
@Tim I don't think what you ask is possible; I've updated the answer with more details. Hope that makes it more clear. –  Riccardo Murri Aug 16 '11 at 23:41
The other reply suggested CPULimit, which seems to do the impossible thing. –  Tim Aug 17 '11 at 0:52
Ah, I didn't know about CPULimit - it definitely fills a gap in my UNIX tool set. –  Riccardo Murri Aug 18 '11 at 21:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.