On Sun, 27 Feb 2005, Ofer Nave wrote:
Here's the POD for my new Parallel::Simple module:

NAME
     Parallel::Simple - the simplest way to run code blocks in parallel

SEE ALSO
     Parallel::ForkControl, Parallel::ForkManager, and Parallel::Jobs are
     all similarly themed, and offer different interfaces and advanced fea-
     tures.  I suggest you skim the docs on all three (in addition to mine)
     before choosing the right one for you.  Or you can foolishly trust the
     executive summaries below:

     Parallel::ForkControl

         Only takes one subroutine reference to run, but provides wonderful
         ways to control how many children are forked and keeping activity
         below certain thresholds.  Arguments to the run() method will be
         passed on to the subroutine you specified during construction, so
         there's some run-time flexibility.  It is not yet possible to learn
         anything about what happened to the forked children, such as
         inspecting return or exit values.

         Conclusion: Best for repetitive, looped tasks, such as fetching web
         pages or running a command across a cluster of machines in paral-
         lel.

         Incidentally, Parallel::ForkControl would be far more useful with
         the following two changes:

         o   Support some kind of feedback - return/exit values at a mini-
             mum, or even a single value summary, like the return value of
             my prun method.

         o   Allow the user to specify the Code value in the run method
             instead of during construction.  Then Parallel::ForkControl
             could do everything this module does and more, albeit with a
             more sophisticated interface.

     Parallel::ForkManager

         Unique in the Parallel::* world in that it keeps the user somewhat
         involved in the forking process.  Rather than taking a code refer-
         ence, you call the start() method to fork and test the return value
         to determine whether you are now the parent or child... almost like
         just calling fork yourself.  :)

         Provides control over how many child processes to allow, and blocks
         new forks until some previous children have exited.  Let's child
         determine the process exit value.  Provides a trigger mechanism to
         run callbacks when certain events happen (child start, child exit,
         and start blocking).  You must supply a callback for the child exit
         event to inspect the exit value of the child.

         Conclusion: While also designed for repetitive, looped tasks, it is
         far more flexible, being a thin wrapper around fork rather than
         taking over child creation and management entirely.  Useful mostly
         if you want to limit child processes to a certain number at a time
         and/or if the native system calls scare you.

     Parallel::Jobs

         Different in that it executes shell commands as opposed to subrou-
         tines or code blocks.  Provides all the features of the open3 func-
         tion, including explicit control over STDIN, STDOUT, and STDERR on
         all 'jobs'.  Lets you monitor jobs for output and exit events (with
         associated details for each event).

         Conclusion: Great for shell commands!  Not great for not shell com-
         mands.

This is a phenomenal initial cut of a POD. The review of relevant other modules in SEE ALSO and the philisophical differences with each deserves particular note. Bravo.


--
</chris>

"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)

Reply via email to