What is Python's Global Interpreter Lock, and how does it shape the way you parallelize work in Python?

technical-conceptual · Mid level · software-engineering

What the interviewer is really asking

Assesses whether the candidate understands why CPython threads don't give CPU parallelism and can pick the right concurrency model (threading, asyncio, multiprocessing) for a given workload rather than reciting a definition.

What to say

What to avoid

Example answers

Strong: On a service that fanned out hundreds of outbound HTTP calls, I moved the calls to asyncio with aiohttp and cut wall-clock latency about 4x, because the GIL is released during the network waits so concurrency was real there. Later I had a CPU-bound image-resize step that didn't speed up under threads, so I switched it to a multiprocessing pool to actually use the cores.

Weak: The GIL is a lock so Python can only do one thing at a time. To go faster you just add more threads and it spreads across cores automatically.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.