Relationship between event loop,libuv and v8 engine

后端 未结 3 1080
我寻月下人不归
我寻月下人不归 2021-02-01 19:45

I am learning through the architecture of Node.js. I have following questions.

  1. Is event loop a part of libuv or v8?
  2. Is event queue a part of event loop? a
3条回答
  •  猫巷女王i
    2021-02-01 20:43

    1. The event loop is, first and foremost, a high-level concept that's a fundamental part of the JavaScript programming model. Practically, every V8 embedder needs to implement an event loop. V8 provides a default implementation, which embedders can replace or extend.

    2. I don't understand the question. (I guess the answer is "yes", but what's the difference between "event loop" and "event queue"?)

    3. None. (Except that Node.js uses both.)

    4. Yes, the event loop is single-threaded.

    5. Yes, browsers have an event loop too (see question 1).

提交回复
热议问题