[Interview] 10_Node event loop

Insert picture description here
Timers phase: This phase executes the callbacks scheduled by setTimeout and setInterval

I/O callbacks phase: Execute callbacks other than the callbacks of the close event, the callbacks set by timers, and the callbacks set by setImmediate()

idle, prepare phase: only used internally by node

Polling phase: get new I/O events, node will block here under appropriate conditions

check phase: execute callbacks set by setImmediate()

Close callbacks phase: execute socket.on('close', …) these callbacks

process.nextTick()有可能插入在Event Loop各个阶段中

Guess you like

Origin blog.csdn.net/dangpugui/article/details/114681984