There are some monks that seem to believe that thread support is somehow important for perl, I could never see a need for it, especially when the arguments goes "Threads are faster then processes", which is true only on Win32. And supposedly it's true because of braindead implementation of process that Win32 uses.

The point is mostly moot, because perl has a very weak support for threaded programs, and there were multiple problems with perl's implementation in the past ( thus one might like to avoid using those features until the stage stabilises ), additionally few distrbutions wisely avoided shipping threaded perl recently, few tried being on the edge, and ended up shipping edgy software...

However, does perl really need threads? Would you use them if they were available in stable form? Is current implementation solid enough?

I think few recent developments like hyperthreading, SMT and SUN's Niagara, which puts ~8 threads on single CPU, make threading support somewhat necessary, other then that, traditionall process model seems more efficient, and definitelly easier to debug.

Woody: This is perl, v5.6.1 built for i386-linux Sarge: This is perl, v5.8.4 built for i386-linux-thread-multi

update

Most replies assume that the only way to use multiple CPUs is by using threads. AFAIK threads make sense only in 2~4 CPUs range, when you add more processors you start running into trouble, what about keeping cache in sync on dozens of CPUS? Since everything is shared, you need to keep everything in sync, which is very costly.

The solution (to the "let's use threads exclusively" problem ) is to build a CPU that uses multiple threads with single shared cache.

IBM's SMT and P4's HT does that, and Niagara does that in a very radical way. You don't want threaded programs on your multi-CPU machine (like 8-core AMD64?).

If you like multi-CPU machines, then you would want to write your programs with as little sharing as possible, you would explicitely marked the areas you want shared, and try to keep this area as small as possible, and that's the state-of-the-art as far as I know.

Has the state of the art changed?


In reply to Threading vs perl by Eyck

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.