I am very new to Javascript and NodeJS. I'm running a simple helloworld program as follows
plan 1
const durationInSeconds = 10; console.log('Hello World'); setTimeout(() => { console.log(`Program has been running for ${durationInSeconds} seconds.`); }, durationInSeconds * 1000);
When I run this program, I am using the htop
command in Linux to monitor the process.
I noticed that the application was creating 7 node instances of the same application.
Why does this happen?
Why doesn't it create just one node instance for a single simple application?
I have this problem because if I run a similar program in python, I only see one instance of the python application running.
Nodejs requires threads to perform other tasks that the V8 engine handles automatically. Some of these things are
Nodejs makes programming easy by hiding these complexities from programmers. If you need more control over this lower level "stuff" then you use C, C++ or other low level languages and you have to decide what should go in which thread.