Talks: Unlocking the Parallel Universe: Subinterpreters and Free-Threading in Python 3.13

Sunday - May 19th, 2024 2:30 p.m.-3 p.m. in Ballroom A

Presented by:

Description

Python 3.12 introduced a new parallel execution model called "sub interpreters" that uses a per-interpreter GIL to unlock a new way of writing parallel code that's faster than multiprocessing. Python 3.13 introduces another new parallel execution model called "free-threading" (previously called no-gil) that replaces that optionally removes the GIL so that threads can truly be parallel. Does free-threading make sub interpreters redundant? We'll answer that question in this talk. We unpack what sub interpreters are, how to use them and their limitations. We'll explore free-threading, the optional flag to remove the GIL in 3.13. Finally we look at a use case for sub interpreters and free-threading together, a multi-worker, multi-thread ASGI web server. We benchmark this against traditional web server architecture with multiprocessing and threading. So fasten your seatbelts, fellow Pythonistas! Let’s ride the comet tail of parallelism, leaving behind the single-threaded past. 🚀✨