Multithreading
suggest changeIntroduction
JavaScript in one Node.js process runs on a single thread. Some work, such as file I/O and dns.lookup, is handed to libuv's thread pool. Network I/O is not.
A second Node.js process is not another thread of the first one. cluster and child_process start more processes. worker_threads (stable since Node 12) runs JavaScript on additional threads inside one process.
Remarks
Understanding the Event Loop is important to understand how and why to use multiple threads.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents