Is there a way to set a Maximum CPU usage in OS X or in General unix life? I've stumbled across a program error in PHP that made Apache take up 98.2% CPU. So is there like a kernel settting or a setting in Apache for this??
Nice doesn't actually limit the CPU usage, it just sets process priority. That means that processes with equal priority always get equal amounts of CPU, but will never take CPU away from processes with higher priorities.
The computer should stay responsive if you give Apache a lower priority. It might still take up 98% of your processor, but it won't take any processor at all if you are trying to do something.
At least, it would mean that on any other Unix OS. Here's the trick - nice numbers/process priorities haven't been implemented in the version of Darwin that underlies OS X PB. I don't know whether the current version of Darwin has this implemented, or whether it will work by OS X final...