Concurrency

Threads, processes, async and await, the event loop and what the GIL actually does.

4 notes

Notes

Python

Threading

Threads let a program wait for several slow things at once. In Python they help with input and output, and cannot speed up pure computation.

Read more
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.

Read more
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...

Read more