What is the Event Loop?
The event loop is what allows Nodejs to perform non-blocking I/O operations — despite the fact that JavaScript is single-threaded — by offloading operations to the system kernel whenever possible.
Event loop explained
When Node.js starts, it initializes the event loop, processes the provided input script which may make async API calls, schedule timers, or call process.nextTick(), then begins processing the event loop.
this diagram shows how event loop order of operations
Each phase has a FIFO queue of callbacks to execute. When the queue has been exhausted or the callback limit is reached, the event loop will move to the next phase, and so on.
Top comments (0)