in reply to Re: Trouble getting started with fork
in thread Trouble getting started with fork

Yes, Parallel::ForkManager has a 'maxprocs' setting which explicitly tells the script how many processes to spawn at any given time. As soon as one finishes, a new one is spawned until the script is completely finished.

An alternative would be to have each child process return a value (1, for example) so you can use that in the parent process to keep a counter. When one starts, increment. When one finishes, decrement, and only spawn a new process if counter < 5.

/\ Sierpinski
  • Comment on Re^2: Trouble getting started with fork