Node.js is a single-threaded language and uses the multiple threads in the background for certain tasks as I/O calls but it does not expose child threads to the developer.
But node.js gives us ways to work around if we really need to do some work parallelly to our main single thread process.
Child Process in Node: The child_process module gives the node the ability to run the child process by accessing operating system commands.
Example: Filename: parallelProcess.js
Before process After process Child Process Starts Data proccessed Child process terminated and returned
Thread send message: Hello World! Worker exit
The process has its own memory space on other hand, threads use the shared memory space. Thread is part of the process. Since worker_threads make new threads inside the same process it requires fewer resources.
- Nodejs | Automatic restart NodeJs server with nodemon
- Node.js | Worker Threads
- Perl | Warnings and how to handle them
- How to handle the warning of file_get_contents() function in PHP ?
- How to handle badwords in Node.js ?
- How to handle the modal closing event in Twitter Bootstrap?
- How to handle errors in node.js ?
- How to handle events in dynamically created elements in jQuery ?
- Merge Conflicts and How to handle them
- How to handle states of mutable data types?
- How to handle multiple input field in react form with a single function?
- How I Handle GATE CS Preparation with College Studies
- Nodejs - Connect MongoDB with Node app using MongooseJS
- Cowsay in Nodejs using Requests library
- Nodejs | Web Crawling using Cheerio
- Web-Socket in NodeJS
- Signup Form Using Nodejs and MongoDB
- Dockerizing a simple Nodejs app
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.