in reply to Re: Re: Re: To Fork for Not to Fork
in thread To Fork for Not to Fork

For my information, can you explain what you consider good about threads?

My overall opinion is still pretty much what I said a long time ago at Threads vs Forking (Java vs Perl). Switching threads is faster, debugging multi-threaded programs is much harder, and as the tangential discussion at the end points out, forking scales better if extreme scalability is needed. (The fact that high-end boxes now tend to jump hoops to avoid scheduling different threads on different CPUs underscores the fundamental scalability issue.)

I have updated some parts of my opinion though. Perl 5.8's threading model makes threading usable in Perl for definitions of usable that include slow and memory bloated.

Therefore I would personally avoid going multi-threaded unless I was writing code to run on a platform that strongly pushes you that way (Java and Windows both come to mind), or unless I was writing an application where interactive latency was significantly more important than throughput (eg a user-facing desktop program).

However I haven't done much with threading (the above shows why I tend to choose not to) and I like to update my information from time to time. (And yes, I do regularly wind up changing my opinion as well...) So I wouldn't mind feedback on why you think that threads are the right direction for people to take in more situations.

  • Comment on Re: Re: Re: Re: To Fork for Not to Fork