0

I was curious Why NodeJS is single thread...?

I know the advantages and disadvantages of nodejs being single thread architecture. but why?

Let me know why nodejs is base reason of single thread!

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
seunggabi
  • 1,699
  • 12
  • 12

1 Answers1

2

Because multi-threaded architectures are more difficult to work with, and in servers - where Node.js is most often used - it's typically enough to just have a non-blocking I/O.

Petr Broz
  • 8,891
  • 2
  • 15
  • 24
  • thanks, but I known your word before question. I solved this by `Node.js is restricted to event-only processing due to the lack of v8 multithreading support. Well, javascript language itself lacks the needed features, so any implementatio will end up being tricky. That's the main culprit of Node.js, In my opinion. In other languages you can choose what you want. Or some hybrid of both models, like java NIO` (reference: https://stackoverflow.com/questions/17959663/why-is-node-js-single-threaded) – seunggabi Sep 18 '18 at 08:58