The concern for memory utilization is valid. The file content is not gathered in the MCE example. Only the chunk id and file path are gathered. The parted content remains inside the output directory until ordered items arrive prior to being merged and unlinked.

... $mce->gather($chunk_id, "$part.out"); ...

The upcoming MCE 1.7 release adds an await method to MCE::Queue. I will demonstrate the gathering of $chunk_id and "$part.out" to a queue and have workers block temporarily in a new MCE::Cookbook.pod. The idea is not to go beyond (200 + max_workers) number of files inside the output directory.

... $q->enqueue( [ $chunk_id, "$part.out" ] ); $q->await( 200 ); # blocks until the queue has 200 or less items ...

Well, will ensure an example is included before releasing 1.7.


In reply to Re^5: Wait for individual sub processes by marioroy
in thread Wait for individual sub processes [SOLVED] by crackerjack.tej

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.