Lab 01: Event Loop Deep Dive
Overview
Step 1: Event Loop Phases
┌───────────────────────────┐
┌─>│ timers │ setTimeout, setInterval callbacks
│ └─────────────┬─────────────┘
│ ┌─────────────┴─────────────┐
│ │ pending callbacks │ I/O errors from previous iteration
│ └─────────────┬─────────────┘
│ ┌─────────────┴─────────────┐
│ │ idle, prepare │ Internal use only
│ └─────────────┬─────────────┘
│ ┌─────────────┴─────────────┐
│ │ poll │ Retrieve I/O events, execute callbacks
│ └─────────────┬─────────────┘
│ ┌─────────────┴─────────────┐
│ │ check │ setImmediate callbacks
│ └─────────────┬─────────────┘
│ ┌─────────────┴─────────────┐
└──┤ close callbacks │ 'close' events
└───────────────────────────┘Step 2: Execution Order Demo
Step 3: Microtask Queue In Detail
Step 4: setTimeout vs setImmediate
Step 5: libuv Thread Pool
Step 6: Blocking the Event Loop
Step 7: setImmediate vs nextTick Performance
Step 8: Capstone — Event Loop Timing
Summary
Queue/Phase
API
Priority
When Runs
Last updated
