Multithreading

suggest change

Introduction

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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents