All you need to know about Concurrency Vs. Parallelism

What is the difference between Concurrency and Parallelism? Although a very basic question, however, I have seen many of the developers struggling to answer it precisely. Hence, Let's understand this fundamental topic and make our concepts clear about it.

Difference between Concurrency and Parallelism

The basic concept of Concurrency and Parallelism revolves around executing multiple tasks. And, the key difference between Concurrency vs Parallelism lies in, how these tasks are getting executed. Let's understand it with some real world examples.


Real-world example of concurrency

Let's say you are drinking coffee and at the same time an important phone call came. Now, in order to attend the call, you will have to pause drinking the coffee for a while. And, you will talk over the phone call. When you are not talking, you will also take a sip of coffee as well. This real life scenario is a classic example to understand the concept of Concurrency. 

Here, you were performing multiple tasks, i.e. drinking coffee and talking over the phone. However, If you observe carefully, you were not doing both of them simultaneously. Although you were dealing with multiple tasks, you were actually doing them one by one. That's exactly what Concurrency is. 


"Concurrency means, multiple tasks are making progress even though they might not be executing simultaneously".


Real-world example of parallelism

Let's now understand Parallelism with a real world example. Let's say you are attending a music concert and thoroughly enjoying it. The performer is singing your favorite song and also dancing while singing it. He is basically performing multiple tasks at the same time. If you carefully observe, he is doing  both of them simultaneously and not one after another. That's exactly what Parallelism is.

"Parallelism means, multiple tasks are making progress all at the same time, and are executing simultaneously".


I hope you have understood the basic difference between Concurrency and Parallelism with real-world examples. Do share it with your friends if you think this was useful and kindly let me know your thoughts about this blog in the comment section below. I would love to read it. Thank you very much for your time reading the blog.  

Wait! Here is something more for you. If you are interested to take a look at some more real-world examples to understand the difference between Concurrency and Parallelism, check this interesting mini-book, which follows an unconventional way to learn technical concept with real-world examples.