Async Vs Threads: Which one is for you?

Recently, I got into a discussion over a coffee about distributed systems in Test Automation and then started to discuss parallelism, concurrency which lead down to the path on Threads, MultiThreaded solutions to Asynchronous and Synchronous way of tests or calls in programming.

Let’s look at them in brief!


Concurrency Vs Parallelism:

Concurrency: Two or more tasks can start, run and complete in overlapping time periods.

Parallelism: Two or more tasks started and executed at the same time.


You wait for it to finish before moving on to another task

You can move on to another task before it finishes.


  • Async functions must have the ability to “suspend” and “resume”
  • An “event loop” keeps track of all the asynchronous functions and their stages of completion and schedules their access to CPU
  • Ways to implement functions that can suspend/resume in Python:
    • Callbacks – Generator or coroutine functions – Async/await (Python 3.5+)
    • Greenlets (requires greenlet package)
  • Ways to implement functions that can suspend/resume in JavaScript:
    • Callbacks
    • Generators
    • Async and await


Standard Hello World Print

Asyncio with Async/Await: Python

Async / Await in JavaScript


When does Async work for you?

  • When you want to Scale
  • Complex tasks
  • A problem that involves tasks with a network I/O
  • busy networks
  • of course, if your server is Async server.

Leave a Comment