Thanks for your kind words Anmol, and thanks for pointing out that behaviour of Node — I was not aware of that (I have used node very little).

However, I would still say that this would be something that Node authors have put in to optimize the system and if we write blocking code, then “something” will block for sure.

This articles explains how the system will work if we have implemented everything in the nonblocking style — “classic” node.js (if you will). That covers the theory of event/interrupt based programs and the closer we stick to it, the better we are leveraging the asychronous paradigm

The kind of optimizations that you mention are implemented by other frameworks as well. e.g. The Vert.x framework expects all code to be written in non blocking handlers, but if your code MUST have something that blocks, it offers a “blockingHandler” construct which will make things run in a backing pool of worker threads.

Hope this clarifies things. Happy to learn more about how Node handles different scenarios from you!

Written by

Code, products, platforms, books, music

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store