Microtasks are process.nextTick and promise callbacks, which run after the current operation and before the next macrotask. Macrotasks are setTimeout, setImmediate, and I/O callbacks, which run one per event loop phase.
What are microtasks and macrotasks in Node.js?
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.
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.
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.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.