Jython, GILs and object locking.

Daniel Dittmar daniel at dittmar.net
Thu Oct 16 15:08:53 EDT 2003


Jon Franz_antispam wrote:
> What if the reference counter system became smart enough so that there were
> n+1 'pools' of objects?  n thread-local pools, and one global pool (for
> objects
> that are in the global scope).  This could be painful to implement, and
> would
> have far-reaching repercussions, but it would remove the locking on
> reference
> counting for local variables that only have meaning within a specific thread
> context.

A test would still be needed in the ref counting macros to check for 
global/thread local. I don't know the overhead for this, but as there 
are special macros that forfeit the check for NULL, I can imagine that 
is isn't neglegible.

And I can't really imagine how the tagging of objects into global and 
local can be made safe enough for the Python environment. Adding a local 
object to a global list would have to tag this object as global as well.

But removing the object from the list wouldn't make it local again as 
there could be other global objects pointing to it.

I think "painful to implement" doesn't even begin to describe it.

Daniel





More information about the Python-list mailing list