Blocking and non-blocking operations

From the understanding of this conceptual model, we can get to understanding the difference between blocking and non-blocking operations.

The key to understanding these is the realization that every synchronous operation results in a blocking operation. That's right, even an innocent console.log('Hello World'); results in a blocking operation  while the Node.js process writes the text to the screen, this is the only thing that it does. There is only one single piece of JavaScript code that can be executed within the event loop at any given time.

The reason this doesn't result in a problem in the case of a console.log() is that it is an extremely cheap operation. In comparison, even the most simple IO ...

Get The Node Craftsman Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.