Multi-processing vs multi-threading vs async-await vs Goroutine

LORY
10 min readJul 2, 2023

All about async programming

Beginning

During the developer interview, below are some common misunderstandings about processing, threading, and async-await. such as

  • “For CPU-bound tasks, always use multi-processing, it is 100% faster than multi-threading”
  • “Multi-threading is similar to asyncio in Python. asyncio will also start a thread, the same as threading”
  • “Multi-threading is only good for I/O tasks because multi-threads can not be executed by multiple CPUs at the same time if they are in the same process”
  • “When called another async within one async function, it started another thread, and when calling ‘await’, which is the same as ‘thread. join()’”
  • “Golang is fast, it is made for concurrency. it is always 100% faster than other languages when doing parallelism”

Hope you will agree with me, all the above, are wrong, or partially correct.

let’s discuss them one by one.

So think about you are going to eat Mc Donald’s with your friends today.

Blocking I/O

So you and 2 of your friends walked into McDonald’s. you ordered a first meal. your friend…

--

--

LORY
LORY

Written by LORY

A channel which focusing on developer growth and self improvement

Responses (2)