Unit content
Interpreter locks and free-threaded runtimes
A language can expose operating-system threads while its runtime still restricts how many threads execute language-level code at once.
Global interpreter locks
A global interpreter lock (GIL) is a runtime mutex that serializes access to interpreter state. It can simplify memory management and extension interfaces, but CPU-bound language code cannot execute in parallel while one global lock protects the interpreter.
Threads can still be useful for waiting on I/O, and native code may be able to release the runtime lock while performing independent work.
Removing a global lock
A free-threaded runtime must replace the protection previously provided by one global lock with finer-grained synchronization, atomic operations or other ownership mechanisms.
That can enable parallel execution on multiple cores, but it also changes implementation costs and compatibility assumptions for native extensions.
The general lesson is that operating-system threads and language-runtime parallelism are separate layers: creating several threads does not by itself guarantee that a runtime executes their language code simultaneously.