Have a look a cgroups. You can define a cpuset that limits the CPUS (cores) processes can use. You could limit it to 2 CPUs, and it will never use more. If it only needs one, other tasks can use the CPU (depending on if you declare it as "exclusive" or not).
I do similar for benchmarks - limit them to all except one CPU. I use that other CPU to monitor how things are going without getting locked out.
Last edited by syg00; 03-08-2012 at 10:37 PM.