Concurrency vs parallelism
The difference between concurrency and parallelism, explained with a kitchen, a timeline animation and code: threads, processes and async, I/O-bound versus CPU-bound work, Python's GIL, race conditions and locks, and how to choose the right tool.
CodexBash, , 5 min read
"Concurrency" and "parallelism" are often used as if they mean the same thing, but they describe different ideas, and mixing them up leads to slow or broken programs. Concurrency is about dealing with many things at once: structuring a program so several tasks make progress, even if only one runs at any instant. Parallelism is about doing many things at once: actually running on several CPU cores at the same moment. This article explains the difference, shows when each helps, and introduces the problems both bring.
Sign in to read the rest
The whole 5 minute article is free with an account, along with every problem, lesson and tutorial. No card.