cpumax - Run as many commands as there are CPUs
cpumax [OPTIONS]
cpumax reads command lines from STDIN, and runs as many in parallel as there are available CPUs.
maxcpu reads command lines from STDIN, and executes as many in parallel as there are detected CPUs.
To portably detect how many CPUs are available, the POSIX system call ``sysconf'' is available. Unfortunately, Perl's POSIX module doesn't include the constant required for CPU detection (_SC_NPROCESSORS_ONLN). As a result, maxcpu uses Inline::C to execute the detection function.
To execute CPU-intensive tasks in parallel, a list of tasks can be created by the shell and fed into maxcpu:
(for i in *.jpg; do echo convert -geometry 640x480 -quality 70 $i $i done) | maxcpu
Kees Cook, <kees@outflux.net>
perl(1), sysconf(3), Inline::C(1).
maxcpu is Copyright (c) 2003, by Kees Cook, <kees@outflux.net>.
All rights reserved. You may distribute this code under the terms of the GNU General Public License.