Perl has a finer control over forking than any shell. It rivals the system C libraries in that regard. You may enjoy comparing your code to perl's native system calls for the job.
my %kid; for (@commands) { defined(my $cpid = fork) or sleep 1, redo; $cpid and $kid{$cpid} = 1, next; # parent %kid = (); # child exec '/bin/bash', '-c', $_; # thanks, ikegami exit 1; } delete $kid{+wait} while %kid; print "@{[times]}\n";
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using perl to speed up a series of bash commands by transforming them into a single command that will run everything in parallel.
by salva (Canon) on Jun 09, 2006 at 20:04 UTC |