DEV Community

loading...

Node.js Process

kamula profile image kamula ・1 min read

Node.js process is a C++ program in execution. In this process node.js runs in a single thread. The diagram below shows how various steps follow each other during the program execution.
Alt Text
When the program is initialized,the code that is not inside any callback function is executed,the modules necessary to execute the program are required, all the callbacks are registered and then the event loop starts executing.
Since node.js is single threaded, heavier tasks like compression and cryptography would block its execution, the event loop offloads these tasks to extra thread pools which are provided by the libuv library.

Discussion (0)

pic
Editor guide