I/O stands for input/output. I/O is used to label a communication between a process in a CPU computer and anything external to that CPU(Memory, disk, network, or even another process) and the process communicates with these external things through signals. They are input when they are received by the process and they are output when they are sent by the process.
In Node.Js’s operations term, I/O refers to network and disk operations which are the most time-consuming operations. Node’s Event Loop is designed around the fact that the largest waste in computer programming comes from waiting for such I/O operations.
First definition: The entity that handles external events and converts them to into callback invocations.
Second definition: A loop that picks events from the event queue and pushes their callbacks to call stack.
For understanding the event loop we need to know about a few concepts:
Call Stack
A first in last out simple data structure. Every time we call a function it pushes to the stack and every time we return from a function it pops out of the stack.
Node Event Queue
Sometimes it is called message queue or callback queue. The event loop pushes callbacks from the event queue to call stack.
#javascript #nodejs #event-loop