300+ free video programming tutorials ― Learn for free!

Node.js Tutorial - #7 - Understanding Events, Blocking, and The Event Model

Category: Node.js - Author: Karl Hadwen

Home > Node.js > Node.js Tutorial - #7 - Understanding Events, Blocking, and The Event Model

Did you find this video helpful? If so, why not subscribe!? ? http://bit.ly/CognitiveSurge

The best shared web hosting: https://www.bluehost.com/track/karlhadwen/

The best simple cloud hosting for developers: https://m.do.co/c/426ceabcea09

As we know Node.js provides incredibly amazing scalability and performance through it's powerful event-driven model. This video focuses on understanding the event model and how we can use the thread pool to stop our application from being 'blocked'. The thread pool (which is in a lot of programming languages) is an incredible asset that allows us to store tasks while we are doing other tasks. So if we're blocking using I/O, we can put that particular task into the thread pool so that we don't block the main thread.

Node.js applications run using a single-threaded event-driven model, although we do incorporate the thread pool to do background work.

In Node.js the event model work is done by adding a particular event as a function with a callback to the event queue. Then what happens is that particular event or function is then executed on the event loop thread in case of non-blocking, or on a completely separate thread in the case of blocking.

Remember: Never block the main thread!

Like the Cognitive Surge Facebook page

Follow me on Twitter (Feel free to tweet me questions!)

Join the Cognitive Surge Subreddit

Follow me on Instagram

Follow me on Goodreads