Misunderstanding of async/await functions
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
async and await make asynchronous JavaScript easier to read, but they do not change how the runtime works. Most confusion comes from assuming that await blocks the whole program, or that marking a function async somehow makes slow work run in parallel automatically.
What async Actually Does
An async function always returns a promise, even when it looks like it returns a plain value.
If you call getNumber() without await, you do not get 42. You get a Promise that will resolve to 42.
That is the first mental model to keep: async changes the function's return type.
What await Does and Does Not Pause
await pauses only the current async function until the awaited promise settles. It does not freeze the event loop, stop timers, or block unrelated requests.
The output order is:
- '
start' - '
before await' - '
end' - '
after await'
That ordering proves the whole program did not stop while task() was waiting.
Sequential and Parallel Work Are Different
Another common misunderstanding is thinking that multiple await calls run in parallel by default. They do not. If you await one promise before creating the next, the work is sequential.
If the operations are independent, start both first and then wait for both:
await improves readability. It does not create concurrency for you.
Error Handling Still Matters
Promise rejections do not disappear just because the syntax is cleaner. Use try and catch when an async function can fail.
A related mistake is forgetting to await the async call at the caller. If you forget, the rejection may escape the try block you expected to catch it.
await Does Not Fix CPU-Bound Work
async and await are mainly about waiting for I/O, such as network calls, database drivers, or file operations. A tight CPU loop still blocks the thread.
Even though the function is async, that loop still monopolizes the JavaScript thread until it finishes. For CPU-heavy work in Node.js, use worker threads or another process. In the browser, use Web Workers.
Loops Need Intentional Design
await inside a loop is not automatically wrong. It is wrong only when you needed concurrency and accidentally serialized everything.
Sequential version:
Concurrent version:
Choose the version that matches the real requirement. Some APIs need order, rate limiting, or dependency between steps. In those cases sequential await is correct.
Common Pitfalls
- Forgetting that every
asyncfunction returns a promise. - Assuming
awaitblocks the whole application instead of only the current async function. - Writing sequential
awaitcalls when the work could run concurrently. - Forgetting to
awaita promise and then treating it like the resolved value. - Expecting
asyncsyntax to make CPU-heavy code non-blocking.
Summary
- '
asyncchanges a function so it returns a promise.' - '
awaitpauses only the current async function, not the whole runtime.' - Independent operations should usually be started first and awaited together.
- Rejections still need explicit error handling.
- '
asyncandawaithelp with asynchronous I/O, not CPU-bound computation.'

