If you want a bunch of gzip jobs to run simultaneously in the background, and you're using a unix system anyway, this seems like a simple enough case for just using the shell:
#!/bin/sh for i in msg.[1-9] msg.10; do gzip $i && echo $i finished & done
Doing that sort of process control in perl just seems a tad more complicated than it needs to be.

On a separate note, assuming you're always doing file sets that are on the same disk (and maybe even if they're not), there will be some number of concurrent jobs -- possibly less than ten -- at which available system resources will be swamped, and adding more jobs beyond that point will not really get things done any quicker -- they'll just spend more time waiting to be serviced.

If you plan to be doing this sort of thing on a regular basis, it may be worth your while to do some benchmarks and find out what the practical limit is on the number of concurrent jobs. (You might also need to consider the impact of your jobs on other activities: e.g., might there be other users or processes trying to access the same disk while you're swamping it with i/o?)


In reply to Re: gzip command always returns -1 by graff
in thread gzip command always returns -1 by jyoshv

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.