Non-blocking I/O - Deepstash

Non-blocking I/O

On the other hand, using a non-blocking request, you can initiate a data request for user2 without waiting for the response to the request for user1. You can initiate both requests in parallel. 

1

STASHED IN:

1

STASHED IN:

0 Comments

MORE IDEAS FROM What exactly is Node.js?

These are libraries built by the awesome community which will solve most of your generic problems. npm (Node package manager) has packages you can use in your apps to make your development faster and efficient. 

STASHED IN:

1

We have to do this, don’t we? 

STASHED IN:

1

Something that has happened in our app that we can respond to. There are two types of events in Node. 

  • System Events: C++ core from a library called libuv.. 
  • Custom Events: JavaScript core. 

STASHED IN:

1

A Node module is a reusable block of code whose existence does not accidentally impact other code. 

STASHED IN:

1

Require does three things: 

  • It loads modules that come bundled with Node.js like file system and HTTP from the Node.js API . 
  • It loads third-party libraries like Express and Mongoose that you install from npm. 
  • It lets you require your own files and modularize the project. 

STASHED IN:

1

Otherwise, here’s a quick step-by-step explanation of how the JavaScript Event Loop works. 

  • Push main() onto the call stack. 
  • Push console.log onto the call stack. This then runs right away and gets popped. 
  • Push Settimeout onto the stack. Settimeout is a Node API.
  • After registering it in the APIs, setTimeout gets popped from the call stack. 
  • Now the second setTimeout gets registered in the same way. We now have two Node APIs waiting to execute. 
  • After waiting for 0 seconds, setTimeout gets moved to the callback queue, and the same thing happens with setTimeout . 
  • Only one statement can execute at a time. This is taken care of by the event loop.

STASHED IN:

1

In the blocking method, user2's data request is not initiated until user1's data is printed to the screen. 

STASHED IN:

1

Node.js is a Javascript Runtime built on chrome’s V8 Javascript engine. It uses an event-driven, Non-Blocking I/O model that makes it lightweight and efficient. It can be anything ranging from Reading/Writing local files to making an Http request to an API. I/o takes time and hence blocks other functions, such as printing.

STASHED IN:

1

Deepstash helps you become inspired, wiser and productive, through bite-sized ideas from the best articles, books and videos out there.

GET THE APP:

RELATED IDEA

Marcus Lemonis

“People, Process, Product”

1

STASHED IN:

26

Nostalgia Reloaded

Pop culture, be it movies, music or TV series, is increasingly and blatantly relying on the past, and using our feeling of the longing of the past, our nostalgia, to bait us into watching or liking the content.

The world, according to many people, is heading towards a wrong and dangerous direction, and we are longing for a less complicated life, trying to find it in the past.

STASHED IN:

145

STASHED IN:

0 Comments