LESSON 01 / 22·2 min readIntermediate

How can Node handle many requests with one JavaScript thread?

Try code in the playground
01 Understand02 Recall03 Prepare

Understand the concept

Node.js is a JavaScript runtime designed to handle many operations that spend time waiting for I/O. It lets the operating system and supporting runtime facilities wait for work, then runs ready JavaScript callbacks on an event-loop thread. This makes one process useful for many concurrent connections without one JavaScript thread per request.

Important ideas

  • Network I/O waits outside the JavaScript thread using the OS and libuv.

  • The event loop runs callbacks when work is ready.

  • Heavy synchronous work still blocks other requests on that thread.

  • Concurrency means multiple requests are in progress; it does not mean their JavaScript runs simultaneously on the same thread.

PAUSE & RECALL

Can you explain it without the notes?

How can Node handle many requests with one JavaScript thread?

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

Node.js is a JavaScript runtime designed to handle many operations that spend time waiting for I/O. It lets the operating system and supporting runtime facilities wait for work, then runs ready JavaScript callbacks on an event-loop thread. This makes one process useful for many concurrent connections without one JavaScript thread per request.

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

  • Describe what happens while a database request waits, and contrast that with a CPU-heavy loop occupying the thread.
Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: What do V8, libuv and the thread pool do?

Adapted from 02_NODE_EXPRESS_HTTP.md · “How can Node handle many requests with one JavaScript thread?”. Examples are study fragments; framework behavior can depend on your version.