Running Python Parallel Applications with Sub Interpreters
Python 3.12 introduced a new API for “sub interpreters”, which are a different parallel execution model for Python that provide a nice compromise between the true parallelism of multiprocessing, but with a much faster startup time. In this post, I’ll explain what a sub interpreter is, why it’s important for parallel code execution in Python and how it compares with other approaches. Python’s system architecture is roughly made up of three parts: To learn more about this, you should read the “Parallelism and Concurrency” chapter of my book CPython Internals. Since Python 1.5, there has been a C-API to have multiple interpreters, but this functionality was severely limited by the GIL and didn’t really enable true parallelism. As a consequence, the most commonly used technique for running code in parallel (without third party libraries) is to use the multiprocessing module. In 2017, CPython core developers proposed to change the structure of interpreters so that the they were better isola
Running Python Parallel Applications with Sub Interpreters Python 3.12 introduced a new API for "sub interpreters", which are a different parallel execution model for Python that provide a nice compromise between the true parallelism of multiprocessing, but with a much faster startup time. In this post, I'll explain what a sub interpreter is, why it's important for parallel code execution in Python and how it compares with other approaches. What is a sub interpreter? ¶ Python's system architecture is roughly made up of three parts: A Python process, which contains one or more interpreters
Explore this link on the map →related reading
- Global interpreter lock - Wikipediaen.wikipedia.org
- PEP 703 – Making the Global Interpreter Lock Optional in CPython | peps.python.orgpeps.python.org
- What Is the Python Global Interpreter Lock (GIL)? – Real Pythonrealpython.com
- Multithreading and Multiprocessing in 10 Minutes | Towards Data Sciencetowardsdatascience.com
- Python behind the scenes #13: the GIL and its effects on Python multithreadingtenthousandmeters.com
- Reading 14: Concurrencyweb.mit.edu
- To Thread or Not to Thread: An In-Depth Look at Ruby’s Execution Models - Shopifyshopify.engineering
- Glossary — Python 3.14.6 documentationdocs.python.org
- Why Learn Python Concurrency – SuperFastPythonsuperfastpython.com
- PiTorch: ML on Baremetal Raspberry Pis | projectsmasonjwang.com
- Multi Core Programming and Threadsimomath.com
- python - How does asyncio actually work? - Stack Overflowstackoverflow.com