简体   繁体   中英

How does event queue is processed in Node js?

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

1) Is event loop a part of libuv or v8?

2) If event loop is responsible for delegating the blocking call to libuv and putting the callback to the event queue, than how does the callback present in event queue goes to call stack for execution?

3) How v8 and libuv interact with each other in Node.js?

Diagram showing the Node Js architecture.

**Can anybody explain me how does v8 gets back the data from event queue to process it in the given diagram?

在此处输入图像描述

Event Loop Diagram

Now can someone tell me which diagram shows the correct position of event loop in Node js architecture?

  1. Eventloop will be part of LIBUV
  2. process.nextTick() taken care by LIBUV. Eventloop internally uses timers, I/O callbacks, idle or process, poll (incoming requests), check, close I/O callback, and connect to timers.
  3. V8 engine takes care of connecting jscode or application to nodejs API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM