in reply to Many children, but never more than a fixed number at once.

I find Parallel::ForkManager good for this kind of thing as it lets you write:
use Parallel::ForkManager; $pm = new Parallel::ForkManager($MAX_PROCESSES); foreach $data (@all_data) { # Forks and returns the pid for the child: my $pid = $pm->start and next; ... do some work with $data in the child process ... $pm->finish; # Terminates the child process }
Code stolen from docs :)

gav^

Replies are listed 'Best First'.
Re: Many children, but never more than a fixed number at once.
by Abigail-II (Bishop) on Jul 08, 2002 at 16:33 UTC
    Yeah, but that requires you to do three lines of code - to create an object (why? What's so OO about this?), and two calls (to ->start and ->finish) for each piece of code you want to execute.

    With mfork or afork, all you have is one call.

    But this is Perl, so there are more ways to do things.

    Abigail