I run above code on fedora and I didn't observe any problem, but then again I don't know what is proper! If you provide a Short, Self-Contained, Correct Example which makes it clear to distinguish between correct and incorrect results I will give it a try.

You should be aware that there are quite a few ways of running a system command via Perl. And some of them involve running it via a shell, and some don't. Also a system command involves a fork. An exec does not, it replaces the current process with the system command. And of course there are various higher-level ways of spawning a system command like IPC::Run. Do you see the problem with all of them? or some of them? Have you also tried to run parallel sleep() from within the shell, avoiding perl to see if that's a perl problem?

bw, bliako

Update:

for long sleep: real 1m40.444s user 0m1.271s sys 0m8.883s for short sleep: real 0m1.901s user 0m1.442s sys 0m6.836s

Update2: use dmesg and check log files to see if the OS complains that certain quota on resources have been exceeded and it can't allocate more (perhaps too many open filehandles? a backticks-system will return back the STDOUT of the command). Use strace -fp PID to see exactly what's going on if you can seave through the maze of output.). Perhaps relevant: GNU-Parallel is an *excellent* tool for spawning commands in parallel and it is written in Perl.


In reply to Re: Perl threads loss of performance with system call by bliako
in thread Perl threads loss of performance with system call by daniel85

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.