262
GIL
also global interpreter lock, CPython
CPython runs one thread of bytecode at a time. Threads do not speed up a pure Python loop.
What is GIL?
The global interpreter lock lets one thread execute Python bytecode. Threads still help when the work releases the lock, which much I/O and many C extensions do. CPU-bound Python needs processes or native code. asyncio is concurrency on one thread. It does not use extra cores.
Why does GIL matter when vibe coding?
The draft starts a ThreadPoolExecutor to speed up a pure Python transform. The cores sit idle and the lock bounces. Or it uses asyncio.gather for CPU work and blocks the loop.
How do you do GIL?
Use threads for I/O that releases the GIL. Use processes or a native extension for CPU. Do not put CPU work on the asyncio loop. Say which one you are doing.
How do you ask a model for GIL?
(Work) is CPU-bound Python. Do not use threads and expect a speedup under the GIL. Use processes or native code. Keep the asyncio loop free of CPU work.
What goes wrong with GIL?
A process pool that shares a live socket or a database connection. Those objects do not survive the boundary. Pass data, not connections.