-2

The NodeJs consists of V8 engine and also libuv library. V8 engine has its own event loop which has call stack , event queue & micro task queue which is used to run our mainland code. The libuv has event loop as well which consist of phases like times,callbacks,poll,check&close. So both these event loops work together. Is my understanding correct? I did not find any relevant answer to this. Can someone explain in detail?

1 Answers1

0

In short, as I know, V8 does not have its own event loop (it has a default implementation, but it is replaced or extended). The only thing V8 really uses is call stack. The event loop stands apart from v8 and is implemented separately in browsers. In NodeJS its role plays libuv.

See also:

Allure
  • 513
  • 2
  • 12
  • If V8 has a call stack then it would have a event queue as well. Then definitely it would have event loop. – Kartik Kumar Jun 04 '21 at 19:57
  • @KartikKumar Sorry, but if something has a call stack, which is normal mechanism of synchronous calls, it is not bound to have an event loop and event queue, which are related to asynchronous actions. these things work together, but any of them may be implemented in different libraries and they can be disconnected. also i've said, that v8 has an event loop, but its default implementation, which is usually replaced or extended. – Allure Jun 04 '21 at 21:27