Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Limit CPU usage of one application

Hi all,

I am looking to a simple way to limit the CPU usage of an application in Mac OS X. In my case, I always have a browser opened on a lot of pages (firefox) and I would like for ewample that this browser never use more than 20% of the CPU power.

This is because I hate to have my Macbook going mad and the fan becoming crazy only with a single page with a small ad in flash, for example.

I have not found it yet, so if anyone of you knows some secret feature of Mac OS X's kernel, a small freeware, or even an unix command I could use to achieve that, I would be very interested 😉.

I already have found a couple of solutions, but usually they have a major issue that is incompatible with my needs, like when the app is killed when it uses more than the limit… I want to limit the cpu use, not to lose all my tabs 😉.

Thanks by advance

Posted on May 18, 2009 2:00 PM

Reply
Question marked as Best reply

Posted on May 18, 2009 2:39 PM

Dunno but you could use this -> FireFox Add-on - Flashblock 1.5.10
"Flashblock is an extension for the Mozilla, Firefox, and Netscape browsers that takes a pessimistic approach to dealing with Macromedia Flash content on a webpage and blocks ALL Flash content from loading. It then leaves placeholders on the webpage that allow you to click to download and then view the Flash content."
10 replies
Question marked as Best reply

May 18, 2009 2:39 PM in response to maxrou

Dunno but you could use this -> FireFox Add-on - Flashblock 1.5.10
"Flashblock is an extension for the Mozilla, Firefox, and Netscape browsers that takes a pessimistic approach to dealing with Macromedia Flash content on a webpage and blocks ALL Flash content from loading. It then leaves placeholders on the webpage that allow you to click to download and then view the Flash content."

May 18, 2009 11:04 PM in response to Chris CA

Thanks again, but it still is not what I am looking for…

This is usefull in case I have multiple programs and I want to limit one program (Firefox and the flash animations on a page) in order to let the other programs use more resources.

But like the wikipedia page says : "if the CPU can deliver more resources than the processes are requesting, then even the lowest priority process can get up to 99% of the CPU."

I am looking for a way to limit my application to 20% of the CPU even if the other programs are not looking for CPU time.

This is because I have a Macbook, and the noise of the fan is really boring. Plus when I use it on battery, using 100% of the CPU and the fan full speed is making me lose a lot of energy uselessly…

I think this is quite difficult to solve, at least I do not know any Unix command that would make the deal (I think ulimit is kind of similar, but it limits CPU usage by killing the process when it goes over the limit, which is not what I am looking for…)

May 18, 2009 11:42 PM in response to maxrou

You are looking for class scheduling software. The following article
explains Apples scheduling algorithms and may be of interest in
seeing whether what you want is achievable.

http://developer.apple.com/technotes/tn/tn2028.html

Some other *nices have this available (Tru64 is one).
I tried a search for "class scheduler" and mostly get links about
software that can schedule classes i.e. school classes and the like.
If you persist through the list you come across something worthwhile.

The following link relates to the Tru64 case.

http://books.google.com/books?id=rhLLHiugbDgC&pg=PA332&lpg=PA332&dq=unixclassscheduler&source=bl&ots=MDuGRVs7q9&sig=-Av0GX2N4hvWfL2yo6SLGl16CP4&hl=en&ei=yVES SqncHaKatAO3t9jqDQ&sa=X&oi=book_result&ct=result&resnum=8#PPA332,M1

Dave

May 19, 2009 12:02 PM in response to maxrou

@maxrou,

I was looking for the same thing and found something that might work. I've tested it a little on my machine and it seems to work for me.

After you download this, you can run it as:
sudo /path/to/cputhrottle 1234 25
where 1234 is the PID of the process you want to limit
(get this by doing a
ps -A
command), and 25 is the CPU percent limit of that process.

http://www.willnolan.com/cputhrottle/cputhrottle.html

Cheers,
Tom

Jul 20, 2009 1:47 PM in response to maxrou

@TomDenver09

I was unable to get the program to work. Every time I try to run it, I get an error.

I tried it with the flowing commands.

PID = Proses ID X = the percentage

sudo ./cputhrottle PID X

sudo cputhrottle PID X

with both attempts, I was unable to get it running, with the following errors respective to the command,

sudo: ./cputhrottle: command not found
sudo: cputhrottle: command not found

Can you tell me why it is not working?. All I did was download the folder and place it inside my home directory. I then used the CD command to get me to the directory. Was there something else that I had to do first?. (I am pretty new to using terminal)

Jul 25, 2009 5:51 AM in response to maxrou

@TomDenver09

I git the same problem as Robert Petersen and was unable to get the program to work. Every time I try to run it, I get the error: command not found

I tried it with the flowing command:
sudo /Users/MYID/Desktop/cputhrottle 6278 15

whereas the path and the app's PID are correct.

I'm new in using the terminal too.

Jul 25, 2009 11:12 AM in response to maxrou

I contacted William, the author of CPUthrottle and here's his advice:

*You must run "chmod +x cputhrottle" after running "gunzip cputhrottle.gz", in order to make the program executable. Otherwise, it will not start correctly.*

For me CPUthrottle works perfectly now - it's a solution for limiting the CPU usage of a Mac application.

It would be great if there would be a Mac like user interface for CPUthrottle - so if you're willing to help let William know. I'm sure there are enough people out there who would like to have a Mac user friendly solution.

Sep 23, 2009 9:39 PM in response to Joachim

Funny, I too contacted William asking him for help with his product.

However, I took the long road to getting this to work correctly. On his site, there are two links.

The first one is the source code, the second is the pre-compiled binary.

To use the source code, it requires a lot of work, including downloading a bunch of developers tools.

Unless you are like me, I highly recommend using the pre-compiled binary version. I would have done this too, but I thought that the link was broken, because when I clicked on it, it opened up a new tab filled with funny characters. I warn all you firefox fans. Go open up safari, then click the link. You will be very very happy if you do this, and it will save you a lot of time.

(I let the author William know about this issue, but It still doesnt apear to be changed)

Yes, in the end I was able to get the files complied from the source code. It took around 8 emails and around 10 hours or trying, but I finally got it to work.

Limit CPU usage of one application

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.