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

Re: threads::shared variables not really shared... or are they?

by Joost (Canon)
on Mar 06, 2008 at 23:49 UTC ( #672631=note: print w/replies, xml ) Need Help??


in reply to threads::shared variables not really shared... or are they?

The answer (probably) is that the data is indeed shared, and the black magic part is where the synchronization between threads is handled. But there are people here who know much more about the perl threading system than me.

On my preferred system (linux) perl threads are just system threads (pthreads). That means that anything "below" the perl language view is shared by default, and the only thing keeping non-shared variables separate is the perl interpreter. That also means that it's much easier to have shared XS objects than shared perl objects (provided you handle your semaphores correctly), and conversely, it's pretty damn hard to handle non-shared XS objects correctly.

  • Comment on Re: threads::shared variables not really shared... or are they?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2021-01-17 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?