Node.js 事件循环的阶段特长

Node.js event loop's phase speciality

我正在学习nodejs的事件循环。

阅读 document 后我有一些疑问。

Each phase has a FIFO queue of callbacks to execute. While each phase is special in its own way, generally, when the event loop enters a given phase, it will perform any operations specific to that phase, then execute callbacks in that phase's queue until the queue has been exhausted or the maximum number of callbacks has executed.

“每个阶段各有特色”是什么意思?

是指运行机制、结构还是职责?

What is meaning of "each phase is special in its own way"?

每个阶段都有自己的工作要做,有些工作与其他阶段截然不同。例如:

计时器阶段检查挂起计时器的已排序链表的头部,并为该列表中时间已到的计时器调用任何回调。

轮询阶段调用 OS 以获取任何未决操作,例如传入网络 activity。

挂起的回调阶段是不适合其他阶段的某些类型的系统事件的 FIFO 队列。

这些阶段中的每一个都有类似的high-level功能(检索和处理准备好运行的特定类型的事件),但它们内部的工作方式完全不同(因此在其特殊之处自己的方式)。