Kill processes automatically that get over x % CPU I have a (rather annoying) process on my iMac that tends to get out of control.

Unfortunately, it's not possible to get rid of it. Much as I want to.

This process is fine at first - using 1-2 % of my dual-core CPU. 

Then it happens. The entire machine slows down. If I can manage to get Activity Monitor open, I can see that the offending process is using 200%, even 300% of my CPU.

Not fun.

If I can get Activity Monitor or Terminal open, and kill the process, it will restart itself and behave like a good little process. For a while. The it goes crazy again.

Being an iOS developer, I'm thinking that the best way to combat this process is an automated assistant.

What I have in mind is a background process that would kill the offending process as soon as its CPU usage hits X%, say 50 or 75%. The the process will restart and become sane without my intervention.

Is it possible? I can write code, AppleScript, anything to make the machine usable again.
This post suggest using monit.
As you have given no details as to the nature of the process, I can't advise whether their suggested config would be of any use for you.