← InterviewIntermediate

What Does the GIL Actually Prevent?

What is the GIL, and what does it mean for concurrency in Python?

The scenario

A CPython 3.12 service runs 16 threads. Half of each request is a database query, half is a pure-Python scoring loop. Throughput is the same at 16 threads as at 4, and the box has 16 cores at 30% utilization.

What it tests

  • Whether the candidate states accurately what is serialized and what is not
  • Whether they know threads still help for I/O-bound work
  • Whether they know the answer is CPython-specific and version-dependent

Answer it out loud first. Recognising a good answer is not the same skill as producing one.