1

many of them saying that node js is single threaded, but it process callback functions parallely during other process. as per my assumption single thread can handle only one instruction at a time. so how it process asynchroniously many instructions at a time?

user8576367
  • 207
  • 3
  • 14
  • I like that discussion about the topic https://stackoverflow.com/questions/40028377/is-it-possible-to-achieve-multithreading-in-nodejs – Simon Franzen Mar 08 '18 at 12:29
  • it is single thread and event-driven architecture. The callback functions are not parallel rather event-driven.Lots of articles are there please have a look – Saikat Hajra Mar 08 '18 at 12:31
  • Node runs a single JavaScript thread with an event loop, plus a thread pool for certain (non-JS) tasks. – Ry- Mar 08 '18 at 12:31
  • 2
    Possible duplicate of [How the single threaded non blocking IO model works in Node.js](https://stackoverflow.com/questions/14795145/how-the-single-threaded-non-blocking-io-model-works-in-node-js) – JJJ Mar 08 '18 at 12:31

1 Answers1

4

Yes, Nodejs is single threaded but internally uses libuv library https://github.com/libuv/libuv

Which is written on c++ and uses thread pooling concept in case if I/O or File system operation and having internal workers for same.

you may go through link to know about deep

https://www.journaldev.com/7462/node-js-architecture-single-threaded-event-loop

Santosh Singh
  • 561
  • 2
  • 16