Python concurrency interview questions
Threads, processes and asyncio, the GIL and free-threaded Python, races in async code, blocking calls, cancellation, limits and request context.
– interview-ready · 12 questions in this topic
– of 12 tried
Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.
Questions
- The GIL, threads and processesPick the fix
- How asyncio worksPredict
- Blocking calls inside async codeFill the blank
- Race conditions in async codePredict
- Sharing state between threads safelyFill the blank
- Limiting concurrency with semaphoresPredict
- Cancellation and cleanup in asyncioPredict
- WSGI vs ASGI serversPredict
Practise this topic
Flashcards · 18
Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.
Quick quiz · 12 questions
One exercise per question, checked as you go. Needs JavaScript.
Mock interview · 2 sets
Timed, out loud, then tick what you covered. Needs JavaScript.
Quick facts
Recall the answer first, then tap Show to check.
Free-threaded Python
Python 3.13 shipped an experimental build without the GIL (PEP 703); Python 3.14 made it officially supported but still optional (PEP 779).
CancelledError
Subclasses BaseException since Python 3.8, so except Exception doesn't swallow it.
asyncio slow callbacks
In debug mode asyncio logs callbacks slower than 0.1 s (slow_callback_duration).
TaskGroup
asyncio.TaskGroup arrived in Python 3.11; it cancels siblings when a task fails.
Gunicorn starting point
Gunicorn's docs suggest (2 × cores) + 1 workers to start, then measure.
Queue.shutdown
asyncio.Queue.shutdown() was added in Python 3.13.
Printable cheat sheet · Review your weak spots in this topic
Share your progress
Sources: Topic outline informed by System Design Primer by Donne Martin and the Zalando RESTful API Guidelines, both licensed under CC BY 4.0. Every question and answer is written by Best Latest Apps. Credits and license