Re:How async/await works in Python
by bilsbie on Friday May 09, 2025 @11:22AM
(#43937822)
How does the GIL come into play here?
[ Parent
| on HN ]
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.