threading.py -> winthreading.c : Some results

Paul Rubin phr-n2002a at nightsong.com
Wed Jan 2 06:24:44 CET 2002


"Tim Peters" <tim.one at home.com> writes:
> However, Python's internal uses of locks-- and particularly the GIL --don't
> need these unusual (relative to what platforms usually offer in the way of
> native synch gimmicks) semantics.  The GIL is "owned":  a thread T that
> acquires the GIL won't try to acquire it again while it's acquired, T will
> eventually release it itself, and no other thread will attempt to release it
> while T has it held.  Most platforms have a more efficient synch
> implementation for this simple usage, but we never got around to creating an
> internal lock type to exploit this.  Just about *any* mutex gimmick would
> suffice except for a spin lock (the GIL can be held by a thread for an
> arbitrarily long time):  the GIL exists solely to enforce serialization.

Is it feasible to replace the GIL with something else, that allows
Python programs to use the parallelism on multi-cpu systems?



More information about the Python-list mailing list