Blocking vs. Non-blocking Mode
Learn about event loops, their disadvantages, and their mechanism in JavaScript and Node.js.
Previously, we studied that in an event loop architecture, everything happens on a single thread.
Take, for instance, reading a file. In a blocking environment, we would read the file and have the process waiting for it to finish until we execute the next line of code. While the operating system is reading the file’s contents, the program is in an idle state, wasting valuable CPU cycles:
Get hands-on with 1400+ tech skills courses.