The biggest problem with Perl threads is that they gobble up tons of memory. You can minimize that by spawning your threads early on, before many modules are loaded, and then loading stuff at runtime with require/import instead of at compile-time with "use". But that means you also have to avoid spanwing new threads after all those modules have been loaded and any large data structures have been initialized, because all that stuff will get copied over into any newly-created threads.
I found threads useful only in Win32, because that platform lacks a native fork() system call and doesn't support many standard IPC mechanisms (or provides very poor support for them). So short of using pure multiplexing everywhere (which is hard, and sometimes counter-productive), threads can be very helpful. But again, you have to be careful about /when/ they get spawned, or else your process will keep growing in size...
In any case, don't expect Perl threads to give you a perfomance advantage over fork(). On SMP machines, separate processes may well run concurrently, but not Perl threads. I'd even be surprised if they were spawned faster than today's nice, fast copy-on-write fork() implementations.

In reply to Re: Perl threading stability? by perlhaq
in thread Perl threading stability? by guice

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.