maxcpu is a perl script to execute command lines read from STDIN on multiple CPUs. For details, see the design document.

2003-06-05 (v1.02)
Fixed dumb typo that totally broke CPU detection.

It was pointed out to be recently that this functionality is available through "xargs". However, the way to get there is a bit convoluted. To do line-at-a-time processing with xargs, you have to use the "-0" option, and replace your newlines with NULL characters. This solution, however, still does not autodetect how many CPUs you have. So, to make things nicer I'm going to have to write a C program to be a shell interface to the POSIX "sysconf" call. In the meantime, the command line that you'd want is:

    (for i in ...; do echo cmds $i; done) | \
        perl -pe 's/\n/\x00/' | xargs -0 -n1 -P2 bash -c
Replace the "2" following "-P" with how many CPUs you have. Under POSIX, the best way to do this is with the "getconf" GNU tool.
    ... | xargs -0 -n1 -P`getconf _NPROCESSORS_ONLN` bash -c
maxcpu is Copyright (c) 2003, by Kees Cook .
All rights reserved. You may distribute this code under the terms of the GNU General Public License.