ARTICLEViews: 56Share  Posted by - Anonymous

Is nodejs single threaded? mostly asked interview question

Node.js is generally considered a single-threaded environment. However, it uses an event-driven, non-blocking I/O model that allows it to handle multiple requests and events simultaneously.

Under the hood, Node.js uses a single thread to handle incoming requests and delegate I/O operations to the operating system's kernel. When an I/O operation is initiated, the thread is freed up to handle other requests or events while the operation completes in the background. Once the I/O operation is complete, a callback function is executed to handle the result.

This approach allows Node.js to handle large numbers of requests efficiently and to scale well, especially for applications that involve heavy I/O operations. However, it's worth noting that CPU-bound tasks can still block the single thread and cause performance issues. In these cases, it may be necessary to use worker threads or other techniques to offload the work to separate threads or processes.


Q. Why Node.js is based on single threaded architecture? Q. What are the different types of APIs available in Node.js? Watch ...

Node.js Interview Questions and Answers | Node.js Interview Questions | Intellipaat

Node.JS Mock Interview | Interview Questions for Senior Node.JS Developers

Top 12 NodeJS Interview Questions and Answers || most frequently asked questions in an interview

NodeJs Interview | NodeJs Interview Questions | NodeJs Questions



Views -