Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: The problem with "The Problem with Threads"

by Corion (Pope)
on Jul 18, 2014 at 11:58 UTC ( #1094204=note: print w/replies, xml ) Need Help??


in reply to The problem with "The Problem with Threads"

Thanks for writing your thoughts about threads. I use threads, and I like them a bit more than most of the other ways to introduce parallelism and concurrency. I only have one quibble with your points:

The "heaviness" of P5 threading is a misnomer. The threads aren't heavy; the implementation of shared memory is heavy. And that could easily be fixed.

As the current implementation of threads tries to simulate parallelism within one interpreter, "fixing" that is not easy as long as you want the promise of implicitly shared things (like the namespace and tied variables most importantly) to remain there. If you move to a less implicit model of sharing, like your usual approach using a queue, and also remove the promise of changes being visible to every thread, or convert it to a threat/warning that changes become visible everywhere, without protection, then I can concur that threads could become less heavy. But as they are now, they are heavy and making the Perl environment look to several threads as if they were the only thread currently running makes them remain heavy.

  • Comment on Re: The problem with "The Problem with Threads"

Replies are listed 'Best First'.
Re^2: The problem with "The Problem with Threads"
by BrowserUk (Pope) on Jul 20, 2014 at 06:28 UTC
    As the current implementation of threads tries to simulate parallelism within one interpreter,

    After 24 hrs of thinking about that statement, I cannot make it gel with my knowledge that each thread starts a new interpreter.

    Given it is you, I assume I'm just misunderstanding your drift?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      No, it was me who is simply wrong. Actually testing reveals that each thread really has its own namespace, like you say. So I'm less sure of where the actual problem or overhead lies with sharing data across threads, at least where the namespace is involved.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1094204]
help
Chatterbox?
[Corion]: Hi marto!
[Corion]: Oooh - finally, I can say no lazy; :)
[Corion]: But it's another The::Net incarnation, too sad ;)
[Corion]: WTF? There is a dev release of Danga::Socket?! I thought that module died a long time ago?! According to its changes, the last release was in 2008 ;)
[Corion]: (and Brad Fitzpatrick long since moved on to Go ;) )
[Corion]: But who am I to worry about necrocpan - I'm revisiting my online banking module, and also I'll somewhat revive WWW::Mechanize:: Firefox, at least if the test suite passes under the Waterfox browser ...
[Corion]: Maybe I should look through my CPAN releases and revisit them in order of last release and think about what to do with the modules :)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2018-07-17 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (359 votes). Check out past polls.

    Notices?