17 Threading and Parallelism
Before the advent of asynchrony in Python, you had two options to improve the responsiveness of your program: threading and multiprocessing. Although the two concepts are often seen as related, and even interchangeable in some languages, they couldn’t be more different in Python.
Threading is a means of achieving concurrency, which is useful in working around IO-blocking tasks, wherein the code is limited by the speed of something external, like user input, the network, or another program. It is not useful by itself for working around CPU-blocking tasks, wherein the magnitude of processing is the cause of code ...
Get Dead Simple Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.