Skip to content

Global interpreter lock

Category: Parallelism · Status: stub · Lessons: chapter 07, Parallelism

One line: A lock that lets only one thread run interpreter code at a time — CPython's, and Ruby's — so threads give concurrency but not CPU parallelism; CPython 3.13 added an optional build without it.

Also called: GIL, GVL, free threading.

How it connects

flowchart LR
  n_gil["Global interpreter lock"]
  n_mutex["Mutex"]
  n_gil -->|uses| n_mutex
  classDef center stroke-width:3px
  class n_gil center
  classDef outside stroke-dasharray: 4 3
  class n_mutex outside

In each language

Python CPython's GIL ↗; the free-threaded build ↗, available since 3.13, disables it
Elsewhere CRuby holds its Global VM Lock (GVL) per Ractor, so ractors run in parallel where threads cannot

Where to read more