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.

My laptop (an HP with an i3 chip) overheats like crazy every time I run a resource heavy process (like a large compilation, extracting large tarballs or ... playing Flash).

I am currently looking into some cooling solutions but got the idea of limiting global CPU consumption. I figured that if the CPU is capped, chances are the temperature will stop increasing frantically, and I'm willing to sacrifice a little performance in order to get the job done.

  1. Am I wrong in my reasoning?
  2. How can I proceed to cap the CPU usage overall?

If it helps, I'm running Debian.

share|improve this question
    
I believe you can do this with cgroups, leaving this here as a pointer instead of an answer because I'm not sure, and I'm not sure how exactly... –  derobert Aug 20 '13 at 14:29
    
You can try to use cgroups. Here is quesiton with similar problem: unix.stackexchange.com/questions/14537/… –  Grzegorz Wierzowiecki Jun 1 at 13:12
add comment

6 Answers 6

up vote 9 down vote accepted

I don't know that limiting CPU to the whole system is something that's possible without a lot of hacking, but you can easily limit the amount of CPU used by a single process using cpulimit

The only way I can think of you being able to use this effectively is writing a wrapper script (can't really call it a script, it's so small) for the applications which you know are resource hogs. Say for example, you find google-chrome uses a lot of CPU, you could replace the google-chrome binary in your path with something like:

#! /bin/bash
cpulimit --limit 70 /usr/bin/google-chrome-bin

I haven't tested this so take it with a grain of salt. From cpulimit's website, it seems like you might be able to set rules for cpu limits on different applications. I'm not sure, you'd have to take a look.

share|improve this answer
add comment

Another alternative that hasn't been mentioned is cpufrequtils, which I have installed and used on my laptop with Debian 6. It allows you to change the algorithm (governor, in cpufrequtils terminology) that the kernel uses to scale the clock rate up and down in response to load - in particular, the userspace governor allows you to lock the frequency at something of your choosing (of course the CPU needs to be capable of running at this speed).

I've used it to lock an Atom at 800MHz instead of 1.6GHz, for example. It's very easy to use.

share|improve this answer
add comment

You can limit your CPU cores automatically based on temperature using the script temp_throttle. It can run in the background while you focus on more important things. An example on how to run:

sudo ./temp_throttle.sh 80 # Will limit CPU cores when 80C is reached.

*Disclaimer- I am the author and maintainer of temp_throttle*

share|improve this answer
add comment

Go into bios and underclock the cpu. - No need for cleverness.

share|improve this answer
add comment

Visit this page, it explains how to install and use cpulimit in Debian and Ubuntu:

http://www.howtoforge.com/how-to-limit-cpu-usage-of-a-process-with-cpulimit-debian-ubuntu

share|improve this answer
add comment

You can use renice to alter the priority of the process by process or group id. From the examples for renice:

  1. Adjust the nice value so that process IDs 987 and 32 would have a lower nice value:

    renice -n 5 -p 987 32

  2. Adjust the nice value so that group IDs 324 and 76 would have a higher nice value, if the user has the appropriate privileges to do so:

    renice -n -4 -g 324 76

  3. Adjust the nice value so that numeric user ID 8 and user sas would have a lower nice value: renice -n 4 -u 8 sas

share|improve this answer
3  
Only a additional note to the answer: renice, nice or other similar tools will not effect in the temperature of the CPU, the problematic process will continue eating the CPU cycles. –  Juan Francisco Cantero Hurtado Aug 23 '11 at 2:35
2  
Nice and renice won't cap the CPU consumption. They simply set priorities. If nothing else is running at the same time, process will still consume all the processing power. –  rahmu Aug 24 '11 at 9:09
add comment

Your Answer

 
discard

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.