Concurrency and Parallelism

I've been reading the 20th Anniversary Edition of the Pragmatic Programmer by Dave Thomas and Andy Hunt. Chapter 6 is on concurrency. Their definitions of concurrency and parallelism weren't new information, but I wouldn't have been able to state them as well as the authors!

Concurrency is when the execution of two or more pieces of code act as if they run at the same time.

Parallelism is when they do run at the same time.

I love that.

Further, they explain what's required to support each:

To have concurrency, you need to run code in an environment that can switch execution between different parts of your code when it is running. ...often implemented using things such as fibers, threads, and processes

To have parallelism, you need hardware that can do two things at once. This might be multiple cores in a CPU, multiple CPUs in a computer, or multiple computers connected together.

I highly recommend reading the book!