Re:How async/await works in Python
by punnerud on Friday May 09, 2025 @11:38AM
(#43938041)
GIL is like a "red-cap" on the head for the CPU-core running the task, so you would not be able to run true Async without GIL. Have to hand the "red-cap" back, for the next task.
Instead of using a global lock ("red-cap"), Python objects have introduced a specialized reference counting system that distinguishes between "local" references (owned by a single thread) and "shared" references (accessed by multiple threads).
In that way enabling to remove GIL in the long run, now starting with making it optional.
Instead of using a global lock ("red-cap"), Python objects have introduced a specialized reference counting system that distinguishes between "local" references (owned by a single thread) and "shared" references (accessed by multiple threads).
In that way enabling to remove GIL in the long run, now starting with making it optional.