Concurrency
Threads, processes, async and await, the event loop and what the GIL actually does.
4 notes
Notes
Python
Multiprocessing
Processes each run their own interpreter with their own GIL, so they can use every processor core. The cost is that nothing is shared by default.
Python
async and await
Asynchronous code runs many waiting tasks in one thread. A coroutine pauses at await, the event loop runs something else, and thousands of tasks becom...
Python
The GIL: What It Is and Why It Exists
CPython allows only one thread to execute bytecode at a time. That single lock explains why threads help with waiting and never with computation.