Node.js · interactive
The libuv thread pool
Your JavaScript runs on one thread, but some async calls run on a small pool of worker threads: 4 by default. Fill the pool with slow crypto and watch a quick file read wait its turn.
Main thread
your JS + event loop
Work queue
3 waiting
Thread pool
4/4 busy
OS kernel
epoll / kqueue
Timeline
- crypto.pbkdf2
- fs.readFile
- dns.lookup
- http.get
Tick 0: all 7 calls start at once. 4 get a thread, 3 wait in the queue.
Work
1 The call returns at once. The work itself happens somewhere else, and your callback or promise waits for it.
crypto.pbkdf2 · crypto.pbkdf2 · crypto.pbkdf2 · crypto.pbkdf2 · crypto.pbkdf2 · crypto.pbkdf2 · fs.readFile
2 3 4 5
In production
Tools and technologies
Any runtime with one event loop needs somewhere to put blocking work: a pool, a worker, or the OS.
Not tied to one language — use these names when you search docs or design a system.