Node.js Event Loop — Six Phases Success-case loop — healthy circuit, no blocking, no starvation Between every callback: drain nextTick, then Promise queue (repeat until both are empty) Can happen after any phase's callback — not animated here. 1 Timers sticky notes — fire when due (late is possible, early is not) 2 Pending Callbacks leftover tray — rare, housekeeping 3 Idle / Prepare internal to libuv 4 Poll — rests here kitchen window — deliver finished I/O; waits here when idle 5 Check table by the window — setImmediate callbacks 6 Close Callbacks clearing tables — socket close, cleanup
Timers — sticky notes fire when due
next: Pending Callbacks
the red dot is the single JS thread — there is only ever one