Although Question is already explained before a long time, I'm putting my thoughts on the same.
Node.js
is single threaded JavaScript
runtime environment. Basically it's creator Ryan Dahl concern was that parallel processing using multiple threads
is not the right way or too complicated.
if Node.js
doesn't use threads
how does it handle concurrent requests in parallel
Ans: It's completely wrong sentence when you say it doesn't use threads, Node.js
use threads but in a smart way. It uses single thread to serve all the HTTP requests
& multiple threads in thread pool(in libuv
) for handling any blocking operation
Libuv: A library to handle asynchronous I/O.
What does event I/O model means?
Ans: The right term is non-blocking I/O. It almost never blocks as Node.js
official site says. When any request goes to node server it never queues the request. It take request and start executing if it's blocking operation then it's been sent to working threads area and registered a callback for the same as soon as code
execution get finished, it trigger the same callback and goes to event queue and processed by event loop again after that create response and send to the respective client.
Useful link:
click here