The Runtime Theory
mediumRuntimeInternals#async-await#event-loop

Does await Run the Rest of the Function on Another Thread?

A runtime prompt about promise suspension, event-loop scheduling, I/O completion, worker pools, and CPU-bound callbacks.

TRT practice prompt — not a verified question from a named employer.

The Runtime Theory Team1 min read

A strong answer

No. In JavaScript, reaching await evaluates an expression and suspends the async function's continuation until the awaited value settles. The current JavaScript stack can return so the host can run other work. When the promise settles, the continuation becomes runnable according to the runtime's job scheduling rules.

The operation itself may progress through operating-system non-blocking I/O, native runtime code, a worker pool, or another mechanism. That depends on the API and platform. await does not identify which mechanism is used, and CPU-heavy JavaScript still occupies the thread that executes it until it yields or is moved to a worker.

In Node.js, the event loop runs JavaScript callbacks and coordinates asynchronous progress. A long callback blocks JavaScript from processing other callbacks even if the machine has spare cores. I would separate waiting for I/O from executing CPU work and instrument the relevant queues before diagnosing a latency problem.

Follow-up direction

Explain where the promise continuation runs and why an event-loop trace must be specific to the host runtime.

This answer walks

Practice follow-ups

  1. 01What happens if the awaited promise is already fulfilled?
  2. 02Why can a long synchronous callback delay unrelated requests?
  3. 03Which Node.js APIs may use a worker pool?

One dispatch a week

The trace behind each question, the tradeoff that explains it, and one technical dispatch per week — no noise.

One technical dispatch per week. No noise.

Not started

Sign in to save your learning progress.

Sign in to save