Concurrent programming in Python is not what you think it is

Click for: original source

In this article, author will first walk you through the distinction between concurrent programming and parallel execution, discuss about Python built-ins concurrent programming mechanisms and the pitfalls of multi-threading in Python. By Melvin Koh.

Concurrent programming is not equivalent to parallel execution, despite the fact that these two terms are often being used interchangeably.

Concurrency is a property which more than one operation can be run simultaneously but it doesn’t mean it will be. (Imagine if your processor is single-threaded)

Parallel is a property which operations are actually being run simultaneously. It is usually determined by the hardware constraints.

The article content is split into few sections:

  • Understanding Concurrent Programming vs Parallel Execution
  • Python Built-ins
  • What is Global Interpreter Lock (GIL)?
  • How to bypass GIL?
  • Multiprocessing – Process-based Parallelism

The constraint of GIL was something that caught author in the very beginning of time as a Python developer. Good read!

[Read More]

Tags programming app-development python web-development devops