cc: [email protected] Subject: Re: [ast-users] suggestion: parallel sh --------
> Hi, > > http://minilien.org/t48k > > the principle is interresting : > > set -j 4 > > however, I prefer to just limit the // executions using the usual & > > for i in 3 5 11 21 8 9 13 7; do > echo sleep $i > ( sleep $i > echo $i finished ) & > done > > than any new keywords like : > > pfor i in 3 5 11 21 8 9 13 7; do > echo sleep $i > sleep $i > echo $i finished > done > > I suppose that the expected result is : > sleep 3 > sleep 5 > sleep 11 > sleep 21 > 3 finished > sleep 8 > 5 finished > sleep 9 > 11 finished > sleep 13 > 8 finished > sleep 7 > 9 finished > 7 finished > 21 finished > 13 finished > > possible usage : > > set -j # > > where # is the maximum number of // jobs > 0 : infinite (default) > -1 : auto-configure to the number of cpu > > FYI : > > AIX : LC_ALL=C lsdev -c processor | grep -c Avail > Darwin : sysctl -n hw.availcpu > Freebsd : sysctl -n hw.ncpu # may support availcpu ? > HP-UX : ioscan -fkC processor | grep -c processor > Cygwin : grep -c processor /proc/cpuinfo > Linux : grep -c processor /proc/cpuinfo > SunOS : LC_ALL=C psrinfo -v | grep -c on-line > > Regards, > > Cyrille Lefevre > -- > mailto:[email protected] > ksh93t aleady has this feature. If you set the variable MAXJOBS=4, then ksh will block until a job completes if you background more than four jobs. You can use the SIGCHLD trap to find out which job as completed and get the exit status. David Korn [email protected] _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
