Concurrency vs Parallelism


  1. Concurrency is when multiple tasks can run in overlapping periods. It’s an illusion of multiple tasks running in parallel because of a very fast switching by the CPU. Two tasks can’t run at the same time in a single-core CPU. Parallelism is when tasks actually run in parallel in multiple CPUs.

  2. Concurrency is about managing multiple instruction sequences at the same time, while parallelism is running multiple instruction sequences at the same time.

  3. In Python, concurrency is achieved by using threading, while parallelism is achieved by using multitasking.

  4. Concurrency needs only one CPU Core, while parallelism needs more than one.

  5. Concurrency is about interruptions, and parallelism is about isolation.

This is a sapling 🌱 in my digital garden 🏡.

Notes mentioning this note

Here are all the notes in this garden, along with their links, visualized as a graph.