Python·100 questions

What is GIL and how does it affect performance?

Answer
GIL limits Python bytecode execution to one thread.
CPU-bound tasks do not scale with threads.
I/O tasks usually work fine with threads.
For CPU — multiprocessing or NumPy (C code).
Alternatives: PyPy, Cython, Rust/Go extensions.
Was this answer helpful?

More questions in this topic

Related questions from other topics