Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Status and usefulness of ithreads in 5.8.0

by kal (Hermit)
on Jul 15, 2002 at 21:42 UTC ( #181931=note: print w/replies, xml ) Need Help??

in reply to Status and usefulness of ithreads in 5.8.0

In a way, it's useful to look at the various OS implementation of threads. Take, for example, Linux - not POSIX-compatible threads, but near enough. But, they're implemented pretty much as fork()s - that's where the non-POSIX-compatibility comes from (or, at least, the most part).

So, what you're actually doing is comparing the management of fork()s. fork(), especially when COW, is extremely lightweight, the main cost being the task switch and the increased complexity in scheduling.

Threading is, therefore, unlikely to gain much in terms of "raw speed". What it might gain, though, is increased readability of code - it's very obvious to see the thread of execution of a master thread, whereas following the various parents of fork()s is not always obvious. And, of course, on non-Unix derived OSes (Windows) threads may actually be quite a win, presuming that they are implemented fairly natively. My personal feeling, though, would be go with what makes the code work out best - if it's easier to understand with threads (esp. working with ex-Java/C++ programmers), that might be the best route.

  • Comment on Re: Status and usefulness of ithreads in 5.8.0

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://181931]
Corion looks at TheDamians new modules. It seems he's written another Perl parser in a regexp and uses it for Keyword::Declare ...
[Discipulus]: from txt to array, from array to polemic, from polemic to flame?
[Corion]: Discipulus++ # profound insight
[Corion]: :-D

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-06-23 07:58 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (536 votes). Check out past polls.