A lot has been said in this thread already. And in Things you need to know before programming Perl ithreads I describe the current status of threads in Perl as I see it.

I agree with chromatic's comments. Perl threads currently provide an interface to doing threads in Perl over doing non-portable stuff in shared memory. It makes it easy and portable. It's not really production ready, especially for a mod_perl environment.

I also agree with most of Abigail-II's comments. Fork() is very cheap on modern *nix systems.

Which is why my forks.pm module gives you a bit of the best of both worlds: the memory savings of fork() and the ability to use a standard Perl executable (even with 5.6.x!) and the portable interface of threads.pm and its shared variables. At the expense of CPU and latency: there is always a price to pay!

Liz


In reply to Re: Why use threads over processes, or why use processes over threads? by liz
in thread Why use threads over processes, or why use processes over threads? by pg

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.