Synchronous vs Asynchronous vs Concurrent vs Parallel
What is the difference and why does it matter?
--
We developers like to throw around terms that feel natural to us, but are technical terms that most non-developers don’t use in the same way. This article is aimed at all the poor souls who have to deal with us, e.g. product managers, product owners, scrum masters, business people.
After reading this article, you will understand the difference between synchronous vs asynchronous vs concurrent vs parallel. Let’s start!
Speeding up Execution
If you want a program or website to feel faster, you have various options:
- Better machines: Buy new hardware
- Do less: Reduce the scope, simplify the business
- Do the things more efficiently: Better algorithms
- Do things in parallel: Make use of multiple CPU cores instead of just one
- Avoid waiting times
Especially the last point is interesting. Think about baking a cake. My oven takes about 15 minutes until it is at 200°C. It takes me about 25 minutes to prepare the cake and it needs to stay for 20 minutes in the oven. How long does it take to make the cake?
The simple way is to execute the tasks one step after each other — sequentially:
- 25 min: Prepare the dough
- 15 min: Pre-heat the oven
- 20 min: Bake in the oven
That is 60 min to bake the cake.
Asynchronous execution reduces waiting times
You can pre-heat the oven. You don’t need to wait for it to pre-heat. This might mean that it stays hot for 10 minutes, but you don’t need to wait. You just reduced the time to make the cake from 60 minutes to 45 minutes!
But you might be able to do even more: By asking your girlfriend to help you, you can prepare the dough in 15 minutes instead of 25 minutes. It’s not exactly half of the time because there are limits in what you can do in parallel. That means both of you worked even longer (2x 15 minutes is 30 minutes of work instead of just 25 minutes), but the time…