Jython, GILs and object locking.

Carl Banks imbosol at aerojockey.invalid
Wed Oct 15 16:58:39 EDT 2003


Daniel Dittmar wrote:
> Harri Pesonen wrote:
>> It will be faster because there is no need to Py_INCREF(Py_None) or 
>> Py_DECREF(Py_None) or other static variables, and because there is no 
>> GIL or thread state swapping, but it will be slower because there will 
>> be an extra state argument in function calls. I guess the speed will be 
>> about the same for single-threaded programs. The real advantage comes of 
>> course from free-threading.
> 
> Py_INCREF and Py_DECREF will have to use some kind of interlock to 
> synchronize reference counting, this will probably slow down things a lot.

See, it seems to me that reference counting is the biggest technical
obstacle to getting rid of the GIL.

If I were getting rid of GIL without a ground-up rewrite, I'd
definitely try to take out reference counting with it, perhaps using
the slot formerly reserved for reference count to keep track of
locking (hopefully one integer value is enough).

Of course, that would require a whole new garbage collection scheme.
But honestly, that's probably simple compared to getting rid of
reference counting and the GIL.


-- 
CARL BANKS                   http://www.aerojockey.com/software

As the newest Lady Turnpot descended into the kitchen wrapped only in
her celery-green dressing gown, her creamy bosom rising and falling
like a temperamental souffle, her tart mouth pursed in distaste, the
sous-chef whispered to the scullery boy, "I don't know what to make of
her." 
          --Laurel Fortuner, Montendre, France 
            1992 Bulwer-Lytton Fiction Contest Winner




More information about the Python-list mailing list