Skip to content
Tech Interview Prep home
Technical interview guide

Concurrency (GIL, Threading, Asyncio)

Why Python threads don't parallelize CPU work, and the two real ways around it: multiprocessing and asyncio.

Read
48 min
Practice MCQs
25
Interview QA
25
Edition
v2
Editorial status
Reviewed

Scope: Python 3.14, covering default GIL-enabled CPython and explicitly optional free-threaded builds.

Interview QA

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

QA-1

Explain precisely what the GIL serializes and which application invariants it does not protect.

QA-2

How does free-threaded CPython remove the GIL, and what are the performance and thread-safety implications for pure-Python code vs C extensions?

QA-3

Design a bounded threaded client for a rate-limited blocking dependency.

QA-4

Choose an execution model for CPU-bound pure-Python work and defend it.

QA-5

How would you make a check-then-act invariant safe across current and free-threaded builds?

QA-6

How does circular wait cause deadlocks in multi-threaded Python, and how does enforcing a strict lock hierarchy prevent it?

QA-7

Compare Events, Conditions, Semaphores, and queues for thread coordination.

QA-8

Design a ThreadPoolExecutor workflow that cannot deadlock on internal future dependencies.

QA-9

Explain process isolation, IPC, and ownership of mutable state.

QA-10

Compare spawn, fork, and forkserver from a library author's perspective.

QA-11

Reduce serialization overhead in a process-based CPU pipeline.

QA-12

How should production code manage process-pool lifecycle and broken workers?

QA-13

Explain coroutine creation, task scheduling, and cooperative suspension.

QA-14

Protect a read-await-write invariant in a single-threaded event loop.

QA-15

Design supervision for background asyncio tasks.

QA-16

Compare TaskGroup failure semantics with ad hoc task creation.

QA-17

Write cancellation-safe coroutine cleanup without reporting false success.

QA-18

Design deadline handling for a non-idempotent remote operation.

QA-19

When is shielding a bounded operation justified, and who owns the inner task?

QA-20

Choose between `gather` and TaskGroup for several related calls.

QA-21

Size and operate an asyncio queue to enforce backpressure and clean shutdown.

QA-22

Separate synchronization across asyncio, thread, and process domains.

QA-23

Use `to_thread` without creating unbounded work or pretending cancellation stops the thread.

QA-24

Manage subprocess pipes, cancellation, termination, and reaping under asyncio.

QA-25

Select a concurrency model from workload, state-sharing, and failure-boundary requirements.