I have a PC with 4 CPUs that is running four jobs. I would like to run another job on it, but only when one of the CPUs becomes available. Is there simple command to do this (I know this is what cluster management systems do, but there should be a simpler solution?)?
2 Answers
http://manpages.ubuntu.com/manpages/trusty/man2/nice.2.html
Nice allows you to change the priority of a process.
e.g
nice 19 yourprogram
Would run yourprogram with the lowest priority, meaning that it will only run when no other [higher] processes are running.
The batch
command from the at package schedules jobs to be run when the system load average drops below a set threshold, which defaults to 1.5. Since you have 4 cpus, you might want to add -l 4
to the command in /etc/init/at.conf to up that limit to 4 instead of 1.5.