Facebook Pixel

What are the event loop phases?

Timers (setTimeout), pending callbacks (deferred I/O), idle/prepare (internal), poll (new I/O events), check (setImmediate), and close callbacks. Each processes specific callback types in order through each tick of the loop.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Node.js Event Loop Interview Questions With Answers

A single-threaded loop that processes callbacks from completed async operations through phases: timers, pending, poll, check, close. It makes Node.js non-blocking by handling I/O asynchronously through libuv while processing one callback at a time.

setTimeout runs in the timers phase after a delay. setImmediate runs in the check phase right after poll. On the next tick, setImmediate usually runs before setTimeout(0) when there are no pending timers.

A Node.js-specific function that schedules a callback to run before the next event loop phase, even before promise microtasks. It is the most urgent scheduling mechanism but can starve the loop if overused, so use it sparingly.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.