When I compile stuff I usually want to do this fast, so on my workstation I issue
And (gnu) make starts compiling with 16 cores. However when I am back on my laptop I don't have 16 cores there. So when I there issue the same command my machine freezes to death. I can't switch to alternative terminals via CTRL+ALT+F1 etc., nor remote login will succeed. CTRL+C, CTRL+4 none of them will be regarded. (BTW: no automatic kill will succeed, e.g. automatic out of memory) I have to power off my machine then. (I use Ubuntu 11.10 with a kernel 3.0.x)
One solution is to get in advance the number of cores available on current machine with a small make target where any other "parallel" targets depend on and don't use "make -j $NUMCORES" directly. (I've already done that and realized with a small c++ program using boost threads). But this won't protect me from accidentally specifying "make -j16" again.
Also "too many" cores must not be the same number of cores (including threading cores) as there are available, as +1 or +2 threads wouldn't still kill the machine.
Can I employ ulimits to moderate the problem? I though about specifying to set swap-space to 0. Then I should have a change on aborting I guess.