I'm working on an application for part of a school project that simulates an operating system and which I launch using the Terminal. By nature it will consume all possible resources to loop over and over. Is there a command or flag I can enter in Terminal to limit the amount of CPU it can utilize while it is running? I tried using the following command:

$ nice -n 20 ./a.out

to set the priority as low as possible, but it still took up 100% CPU to run. It's a rather simple program and hardly needs any resources to work properly so any limits imposed on it should be fine.


As nice only gives priority over over applications it won't stop 100% CPU usage.

Cputhrottle has worked for me in the past, though haven't checked it for 10.11 : http://www.willnolan.com/cputhrottle/cputhrottle.html

  • Will cputhrottle work if I often start and stop the process? I'll be debugging it so the process number will change often when it gets restarted.
    – intcreator
    Jan 28 '16 at 22:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .