Python concurrency and parallelism explained
If you program in Python, you have most likely encountered situations where you wanted to speed up some operation by executing multiple tasks in parallel or by interleaving between multiple tasks.Python has mechanisms for taking both of these approaches, which we refer to as parallelism and concurrency. In this article we’ll detail the differences between parallelism and concurrency, and discuss how Python can employ these techniques where it makes the most sense. [ Tune into Serdar Yegulalp’s Smart Python video tutorials to learn smart Python tricks in 5 minutes or less ] Concurrency vs. parallelism Concurrency and parallelism are names for two different mechanisms for juggling tasks in programming. Concurrency involves allowing multiple jobs to take turns accessing the same shared resources, like disk, network, or a single CPU core. Parallelism is about allowing several tasks to run side by side on independently partitioned resources, like multiple CPU cores.To read this article in full, please click here
If you program in Python, you have most likely encountered situations where you wanted to speed up some operation by executing multiple tasks in parallel or by interleaving between multiple tasks.
Python has mechanisms for taking both of these approaches, which we refer to as parallelism and concurrency. In this article we’ll detail the differences between parallelism and concurrency, and discuss how Python can employ these techniques where it makes the most sense.
Concurrency vs. parallelism
Concurrency and parallelism are names for two different mechanisms for juggling tasks in programming. Concurrency involves allowing multiple jobs to take turns accessing the same shared resources, like disk, network, or a single CPU core. Parallelism is about allowing several tasks to run side by side on independently partitioned resources, like multiple CPU cores.