This outputs 31 on my system? Would be way too much. It's probably up to every user himself to define this variables. Because some users may prefer low number for better interactivity and less loads, some take something in the middle and others (like me) tend to set quite high values to get a decent load onto their CPU or to make use of distcc.
At the other hand I'm not completely opposed to this. But this command would be the way to go:
- Code: Select all
getconf _NPROCESSORS_ONLN
I think it's the only solution which works properly on a wide variety of systems. I think it's also no good idea to run more parallel jobs than there are processors.
On a sidenote, some programs can't be built with multiple jobs. So this could introduce problems, although actually in this case the build script should just ignore the variable and default to one job.