Hence the existence of forks.pm. It has the improved efficiency of creating a new "thread" because it uses fork() to do that
  1. How long does it take to start one thread per core? Answer: 0.0334138870239258 / 4.

    Sure, fork will be faster. But on any process long-running enough to be worth multi-threading, 0.01 per core is but a drop in the ocean.

  2. How long does it take to communicate 1000 work items to each of those work threads? Answer: 4 cores; 4 threads; 4000 items; 0.113806962966919 seconds.

    How long will it take to

    1. freeze those work items;
    2. send them via sockets;
    3. receive them at the other end;
    4. unfreeze them?

    And I bet that establishing those socket connections more than negates the lower start-up cost of fork.

Which timing is the more important?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re^8: Strange memory leak using just threads (forks.pm) by BrowserUk
in thread Strange memory leak using just threads by MnkyBrain

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.