An application I'm contributing to fires up a component written in C.
The C process does some pretty heavy crunching and if your not careful can really hammer your CPU.
Is there a way to set a limit to external processes spawned by .NET?
I've seen this artivcle on setting a hard memory limit at the OS level, is there a similar thing for CPU?
Not in Windows. You can lower the process priority though, which will reduce the likelihood that the problematic process will be scheduled on the CPU and interfere with other (presumably higher priority) applications. For instance, from http://dotnet-concepts-queries-interviews.blogspot.com/2007/05/how-to-set-process-priority-in-net.html:
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;
Keep in mind, if you don't have anything else running on the box, you probably want this process to consume all of the available CPU.
You can also set the CPU affinity if it is on a multi-processor box, limiting the processing to certain cores and leaving others free for other applications. Generally the OS does a good job of scheduling application threads though, so setting the process priority is likely to have a better overall result. See How Can I Set Processor Affinity in .NET?