Explain Asynchronous VS Synchronous
Apr 21, 2021
So first of all you need to understand the difference between them let’s begin :
synchronous code is executed in sequence — each statement waits for the previous statement to finish before executing. Asynchronous code doesn’t have to wait — your program can continue to run.
where we use them :
Asynchronous is best suited when processing the following requests:
I/O bound requests. Examples : writing/reading to a file or database, making API calls, calling hardware like printers etc.
CPU bound requests (requires CPU time).
Synchronous is best suited when processing the following requests:
We use them for the same purpose as asynchronous but without timer .