-1

I'm learning event loop of nodejs.

I have some of question after reading in 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"?

Is it means running mechanism, structure or resposibility?

ogelacinyc
  • 1,272
  • 15
  • 30
  • I think it just means "each phase is different". To me, the meaning of "mechanism, structure or responsibility" is much more unclear. – GOTO 0 Feb 12 '22 at 03:12

1 Answers1

1

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

Each phase has its own job to do and some work pretty differently than others. For example:

The timers phase checks the head of a sorted linked list of pending timers and calls any callbacks for timers in that list whose time has arrived.

The poll phase calls the OS to get any pending operations such as incoming network activity.

The pending callbacks phase is a FIFO queue of certain types of system events that don't fit into other phases.

Each of these phases has a similar high-level function (retrieve and process a specific type of events who are ready to run), but all work completely differently inside (thus are special in its own way).

jfriend00
  • 683,504
  • 96
  • 985
  • 979