I followed a previous discussion and as a result read perlipc. There is a part of my requirement that doesn't seem to be covered there. I have 150000 jobs defined in a language called jil in a single file that I want to load individually through a utility. Some of the jobs will have syntax errors and some will fail but could succeed on retry. So I wrote a parser in OO-Perl that gets an individual job from the file. Now I am designing a method called spawn_jil which should create a subprocess e.g. with fork or open to load the jobs in parallel; but if a certain number of subprocesses have not yet exited it has to wait until less than that number of subprocesses are still alive. So my thought processes went something like: suppose the parent creates a filehandle for the child to communicate back (use Filehandle) before spawning. It puts it in a hash and after iterating through the parser it has to destroy filehandles for exited subprocesses. I don't see a method for that in the Filehandle package. The child can't create the filehandle because the parent then won't have access to it. I can't use the database because the overhead would defeat the whole purpose. Ideally I'd like to avoid communicating via a storable. Any ideas? Thanks

One world, one people


In reply to fixed set of forked processes by anonymized user 468275

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.