in reply to Perl threading stability?
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.
|