How To Use Multithreading in Node.js
Since JavaScript is single-threaded, it blocks the main thread and no other code executes until the task completes. To understand this, you will create a Node.js program with an infinite loop so that it doesn’t exit when run. Using nano or your preferred text editor, create and open the process.js file: nano process.