Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-25 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found