Event loop

Node.js registers with the operating system so the OS notifies it of asynchronous I/O events such as new connections. Within the Node.js runtime, events trigger callbacks and each connection is handled as a small heap allocation. Traditionally, relatively heavyweight OS processes or threads handled each connection. Node.js uses an event loop for concurrent I/O, instead of processes or threads.[61] In contrast to other event-driven servers,[which?] Node.js’s event loop does not need to be called explicitly. Instead, callbacks are defined, and the server automatically enters the event loop at the end of the callback definition. Node.js exits the event loop when there are no further callbacks to be performed.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *