Member-only story
Which Should You Use: Asynchronous Programming or Multi-Threading?
Differences, common misunderstandings, and Python examples

When it comes to software engineering, there is often a little confusion about these two concepts. They are both forms of concurrency, but they do not mean the same thing and are not applied the same way, or used in the same scenarios.
The simple explanation is that threading is about workers; asynchrony is about tasks. But let’s explore that a bit.
Analogously, let’s say we want to cook a breakfast of eggs and toast. How would we do it?
Synchronous Approach
The simplest way would be to do it in sequence:
- Get out the eggs, bread, and pan, and turn on the stove.
- Crack eggs and pour them into the pan.
- Wait for eggs to finish cooking.
- Take eggs off and add seasoning.
- Place bread into the toaster.
- Wait for the toaster to complete.
- Take out toast.
Total time for breakfast: 15 minutes.
Simple enough right? If we say the cooking of the eggs in this fashion is analogous to executing a program, we’d say that this was a synchronous way to cook the eggs.
We have one person doing all the tasks, in a series (serialism). We are doing each step in order, and we can’t move on to the next step without completion of the last. A more technical definition is that each task is blocked from execution from the previous step, and it’s all being done by one worker. We can’t move forward without doing the last step. In this example, we are our computer’s central processing unit, or CPU. Every task completed is done by one person (one CPU).

Ok cool, we’ve cooked eggs. But what if we wanted to make our morning even faster? You may be saying to yourself, “I don’t wait for my eggs to finish to put the toast in.”