Abstract

Before trying to write any meaningful Node applications, it's important to understand what's going on under the hood. Probably the most important thing to understand is that JavaScript—and Node by extension—is single threaded. This means that Node applications can do exactly one thing at a time. However, JavaScript can give the illusion of being multithreaded through the use of an event loop. The event loop is used to schedule tasks in Node's event-driven programming model. Each time an event occurs, it is placed in Node's event queue. In each iteration of the event loop, a single event is dequeued and processed. If, during processing, this event creates any additional events, they are simply added to the end of the queue. When the event is completely handled, control is returned to the event loop, and another event is processed.KeywordsFile SystemEvent EmitterException HandlingInfinite LoopFinal CallbackThese keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.