Python GIL explained
Explain the CPython GIL. When do threads help, and when should you use multiprocessing or asyncio instead?
Answers use simple, clear English.
Quick interview answer
The GIL allows only one thread to execute Python bytecode at a time. Threads help for I/O-bound work (waiting on network/disk) because the GIL is released during blocking I/O. For CPU-bound pure Python, use multiprocessing or ProcessPoolExecutor.
Detailed answer
The GIL allows only one thread to execute Python bytecode at a time. Threads help for I/O-bound work (waiting on network/disk) because the GIL is released during blocking I/O. For CPU-bound pure Python, use multiprocessing or ProcessPoolExecutor. For many concurrent sockets, prefer asyncio. NumPy/C extensions may release the GIL during heavy C work.
Real example & use case
Web scraper: ThreadPool/asyncio for HTTP; image resize batch: ProcessPoolExecutor.
Pros & cons
Pros: simple mental model. Cons: GIL surprises; free-threaded Python 3.13+ changes options.