[Python-Dev] GIL removal question (original) (raw)

Rene Nejsum rene at stranden.com
Sat Aug 13 00:51:40 CEST 2011


Thank you for the clarification, I should have been more precise...

On 12/08/2011, at 23.38, Guido van Rossum wrote:

On Fri, Aug 12, 2011 at 12:57 PM, Rene Nejsum <rene at stranden.com> wrote:

I think I understand the background and need for GIL. Without it Python programs would have been cluttered with lock/synchronized statements and C-extensions would be harder to write. No, sorry, the first half of this is incorrect: with or without the GIL Python code would need the same amount of fine-grained locking. (The part about C extensions is correct.) I am butting in because this is a common misunderstanding that really needs to be squashed whenever it is aired -- the GIL does not help Python code to synchronize. A thread-switch can occur between any two bytecode opcodes. Without the GIL, atomic operations (e.g. dict lookups that doesn't require evaluation of eq or hash implemented in Python) are still supposed to be atomic. -- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list