Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I would like to limit the amount of CPU time dedicated to certain processes (e.g. Firefox, Safari, ...).

I can't understand why such programs, even when not used (nothing loading, no animations, running in the background, ...), are so resource hungry. Why a browser must eat 50% or more of my CPU? Can I limit it to 10%?

Thank you.

share|improve this question
1  
No this is not possible. With all due respect, the point of a system is to get used. Letting CPU cycles go to waste is utterly pointless. You might as well just downgrade your system if you plan on doing that. Just out of curiosity, what do you hope to gain? In other words, may I ask why you would want to do this? –  cksum Sep 14 '11 at 10:05
1  
If I have a process that needs the CPU to do serious work, and this is busy with a browser I am not even using, it is not an optimal use of resources. And when running on batteries, having a process that keeps the CPU busy doing nothing is not good. –  Pietro Sep 14 '11 at 10:30
2  
One might also be giving yourself "working room". For example, I have a process that will tie up my entire processor for the better part of an hour. I'd rather it take two hours but my computer be usable in that time. –  Fomite Sep 19 '11 at 21:22
1  
@cksum this is possible. –  faraz May 5 '12 at 2:44
add comment

3 Answers 3

up vote 2 down vote accepted

You can monitor a series of processes by name by running the Bash script below. I'm not quite sure how to turn this into a login item since cputhrottle requires superuser permissions. Run it as a script, in an Automator workflow, whatever:

# Get the Process/App names from Activity Monitor and put them here
apps=("AppOne" "AppTwo" "AppThree")
# Set the respect limits here
limits={30 40 50)

while true; do
  for ${app} in ${apps}; do
    for ${limit} in ${limits} do
      for pid in `pidof ${app}`
        sudo /path/to/cputhrottle ${pid} ${limit}
      done
    done
  done
done
share|improve this answer
add comment

You can indeed! There's CPUThrottle, which allows to specify a PID to restrict.

Note, they're trying to use that much for a reason, it's a useful tool but whether it'll make it better or worse for you on a day to day will be something you discover.

share|improve this answer
    
Interesting. But with this utility I have to launch a program, find its PID(s) and manually use cputhrottle. Every time I launch it. Is there something that allows me to tell the system: “From today always run this program with a maximum of 25% CPU” ? –  Pietro Sep 14 '11 at 10:45
    
As far as I'm aware no, I've only ever come across CPUThrottle. –  Nicholas Smith Sep 14 '11 at 11:03
add comment

The link that Nicholas Smith posted doesn't work anymore. So I found one other app that does the trick for the people who are searching it again. the app calls Apppolice.

http://www.macupdate.com/app/mac/49836/apppolice

share|improve this answer
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.