There are several options, some of which were pointed out in this recent node

I'll go on about forking()..
You can fork() then exec() if you want to run external commands, or fork() and run a block of code if you want to do everything in Perl.

Parallel::ForkManager is a nice module which may help fork and track tasks to be run in parallel.

Hand rolling your own forking and process tracking subroutines/modules might be other option - co-ordinating a number of dependent tasks is not easy.
If you can perform a number of tasks, wait for of all them to finish, check the statuses, then execute another block of parallel tasks, it's not impossible, just takes a bit of thinking :-)

If you want to know when a child process has finished, you could either:

There are probably other ways as well.

My personal solution was to roll a module to handle fork()'ing and another to dole out tasks, track their return codes, and resubmit them to be processed again if they failed.
I just looped with a small delay to stop the parent eating a lot of CPU time.

Hope that helps.
BazB.


In reply to Re: Caught Forking() around again by BazB
in thread Caught Forking() around again by P0w3rK!d

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.