Jython, GILs and object locking.

Dave Kuhlman dkuhlman at rexx.com
Sat Oct 18 15:43:26 EDT 2003


Harri Pesonen wrote:

> Aahz wrote:
>> In article <NmBjb.253$en5.245 at reader1.news.jippii.net>,
>> Harri Pesonen  <fuerte at sci.fi> wrote:
>> 
>>>Why? Each thread has its own variables, they are not shared,
>>>there is no need for synchronizing.
>> 

Just to make this a little more real -- Yes, scripts executed in
each thread (each sub-interpreter) do have their own variables
(e.g. their own set of globals) and the scripts executed in that
thread can execute as through they are separate from and isolated
from scripts run by other sub-interpreters in other threads.

However, it is possible, for example, to implement in C an
extension function that, when called, would give scripts executing
under different sub-interpreters access to a common (set of)
Python object.  Scripts running under different interpreters that
manipulate that shared object have to be protected from one
another.  And, I'm guessing that this is one of the situations
where we need the GIL.

[snip]

Dave

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman
dkuhlman at rexx.com




More information about the Python-list mailing list