At 17:36 +0530 12/17/02, Aravind Srivaths wrote:
 > I'm not sure I understand what the problem is here or what you're
 > trying to achieve or point out.  Could you elaborate?
Ok, let me start with a question instead - is it possible for two
instances of the interpreter to hold one reference each to a variable?
To my knowledge that is impossible. Each interpreter is a "universe" on its own.


If this is possible, then it must be possible to implement shared
variables by just housing them in a special interpreter instance and
incrementing reference count every time a clone is done.  Is this
how it is really implemented?
Unfortuntately that is not the way it is implemented.


Next how is scoping implemented for shared variables - how does the
'special interpreter' where shared variables live know what stash
to fetch the variable from?  I could not figure this from the code.
That's probably because the interpreter doesn't know. As far as the interpreter is concerned, a shared variable is a variable like any other variable that is tied: it calls specific functions to fetch and store values. It's what happens inside those routines, that makes the variables appear as shared when running under threads.


Hope this explains it a bit.


Liz

Reply via email to