Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^7: Trying to Understand the Discouragement of Threads

by Jenda (Abbot)
on Nov 19, 2014 at 10:24 UTC ( #1107726=note: print w/replies, xml ) Need Help??


in reply to Re^6: Trying to Understand the Discouragement of Threads
in thread Trying to Understand the Discouragement of Threads

If you don't clone something, you can either disable access or share. As you can't disable access to most of that stuff, you've got to share it and once you share it, you've got to protect it and still run the risk of ending up in an inconsistent state thanks to race conditions and lack of locks.

I do not think your blame of the fork emulation is correct.

Jenda
Enoch was right!
Enjoy the last years of Rome.

  • Comment on Re^7: Trying to Understand the Discouragement of Threads

Replies are listed 'Best First'.
Re^8: Trying to Understand the Discouragement of Threads
by BrowserUk (Patriarch) on Nov 19, 2014 at 10:59 UTC
    As you can't disable access to most of that stuff, you've got to share it and once you share it, you've got to protect it and still run the risk of ending up in an inconsistent state thanks to race conditions and lack of locks.

    Why would there be any "lack of locks"? You're (wrongly) assuming that the only alternative to cloning, is direct, unfettered access. It isn't.

    Just as the internal state of threads::shared variables are protected now, so would the single, shared copy of the currently-cloned, process global state be so protected. It would have to be, because it would live in exactly the same context, and would be accessed in exactly the same way.

    That doesn't remove the need for user locks to protect user state, but it does preclude the user from having to protect Perl's internals state.

    I do not think your blame of the fork emulation is correct.

    I cannot help what you think.


    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.
Re^8: Trying to Understand the Discouragement of Threads
by Anonymous Monk on Nov 19, 2014 at 10:28 UTC

    As you can't disable access to most of that stuff...

    Weak argument

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1107726]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2022-10-07 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (29 votes). Check out past polls.

    Notices?