Concurrency in Python

Learn what it is, and how and when to implement it

Erik van Baaren
Python Land

--

Photo by Dennis van Zuijlekom on Flickr

As published in our tutorial on Python concurrency at python.land. Enjoy!

What is concurrency?

Concurrency is working on multiple things at the same time. In Python, this can be done in several ways:

  • With threading, by letting multiple threads take turns.
  • By firing off a task and continuing to do other stuff, instead of waiting for an answer from the network or disk. This is how asynchronous IO operates with the asyncio library.
  • With multiprocessing we’re using multiple processes. This way we can truly do more than one thing at a time using multiple processor cores. This is called parallelism.

Concurrency is working on multiple things at the same time

Make sure to check out our latest story as well:

Is concurrency really what you want?

--

--