Threads are much more efficient...It is also harder to have 2+ forks() communicate (PIPE or socket or shared memory) vs direct access to all data structures

For the love of all that is holy why do you youngsters think this stuff. Free your mind (from Win32s land) and your code will follow.

Efficiantcy: fork() + SysV shared memory is just as fast on Linux as threads. Further, you get the advantage of explicitly shared data, rather than the joys of tracking down obscure memory corruption bugs.

Easy of Use: Unix process calls + SysV shared memory API are far more simple than the POSIX thread API and more useful to learn overall.

Threads are faster for context switching than processes on old propietary unixen/winnt. That is because all those proprietary OSes were created to sell hardware. Why should they care about speeding up the common case?

Unix is an amazing API. With proper implementation it is awsomely powerful, fast, and simple. Threads are a context switching optimization/abomination.

However, perl threads could make POE really cool on multi-processor machines (re: thread per CPU to implement an explicit state machine).


In reply to Re: Re: Re: Multi-Threading in Perl by LunaticLeo
in thread Multi-Threading in Perl by Alex the Serb

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.