perrin has asked for the wisdom of the Perl Monks concerning the following question:

I need to build a script that performs a task in parallel, for improved performance. It follows the fairly standard "looping on a big list of jobs" approach shown in the man pages of the forking modules I've looked at.

People here seem to mention Parallel::ForkManager quite a bit, but I'm intrigued by the interface to Parallel::ForkControl. So, my question is, has anyone used Parallel::ForkControl, and if so, would you recommend it?

  • Comment on Parallel::ForkManager or Parallel::ForkControl?

Replies are listed 'Best First'.
Re: Parallel::ForkManager or Parallel::ForkControl?
by kvale (Monsignor) on Mar 03, 2005 at 00:00 UTC
    I have used Parallel::ForkControl before and it seemed to work fine. On the other hand, I was only running a max of 5 children at the time, so didn't run into the possible fork-bomb issues mentioned in the manpage.

    I think Parallel::ForkControl is useful for those who want to code fast, or don't want to dive into Unix processes too deeply. Parallel::ForkManager, in exchange for a bit more code, offers finer-grained control of the forking and reaping process. If I had a small number of parallel non-interacting children processes to execute, I'd be fine with Parallel::ForkControl. But if the children depended on one another in some way or I needed to spawn a lot of processes, I'd want the control of Parallel::ForkManager

    -Mark

Re: Parallel::ForkManager or Parallel::ForkControl?
by FitTrend (Pilgrim) on Mar 03, 2005 at 04:48 UTC

    Based on the typical scripts that require/need child processes that I've written, I'd recommend Parallel::ForkManager. Both of them seem to have some issues with many child processes running simelantously. However, I can get a little more out of Parallel::ForkManager. Even though it can do up to 30 (I believe), I can get 7 to work fine. Any more than that occasionally causes some issues. I primarily program on the windows platform, so these kinds of modules (that utilize forking) are a touchy subject :). That said, I've had my greatest success with Parallel::ForkManager.

    Hope this helps

Re: Parallel::ForkManager or Parallel::ForkControl?
by Limbic~Region (Chancellor) on Mar 03, 2005 at 13:52 UTC
    perrin,
    Since you are specifically asking for Parallel::ForkControl experience, I didn't respond last night. Instead, I sent you a /msg that I liked the fact that Parallel::ForkManager had callbacks that Parallel::ForkControl doesn't seem to support. Since there hasn't been an overwhelming response to your question, I want to add this in case someone else is doing a similar comparison later on.

    Cheers - L~R