Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Limiting the number of forks

by larryk (Friar)
on Oct 02, 2002 at 12:21 UTC ( #202241=note: print w/replies, xml ) Need Help??


in reply to Limiting the number of forks

There is a module that already provides this functionality: Parallel::ForkManager
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 }
The code above is an excerpt from the man page of P::FM.

Hope this helps,

   larryk                                          
perl -le "s,,reverse killer,e,y,rifle,lycra,,print"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://202241]
help
Chatterbox?
[choroba]: Merkine?
[erix]: Nashorn is Diceros not monoceros
[choroba]: Seefeld in Tirol?
[shmem]: this
erix notes the cloven hoof

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2017-03-30 17:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (362 votes). Check out past polls.