DEV Community

Discussion on: Basic Concepts of Node.js

Collapse
 
ahmadawais profile image
Ahmad Awais ⚡️ • Edited

Unfortunately that's a wrong diagram for the event loop. Node.js event loop is not like the JavaScript loop at all. 99% of diagrams like these are just simply wrong.

I taught this as part of my premium Node CLI Development course, but just shared that 10min video on Node.js theory, publicly for free on my YouTube Channel here.

Nodejs Event Loop

I hope it's helpful.

Collapse
 
olaviolacerda profile image
Olavio Lacerda

Would you have an example of a good diagram? Share with us, please!

Collapse
 
bam92 profile image
Abel Lifaefi Mbula

You read about event loop here.

Thread Thread
 
cassiocappellari profile image
Cássio Santiago Cappellari

Thanks a lot for sharing, for sure I'll read about it!

Thread Thread
 
yiorgosc profile image
yiorgosc

I think both explanations are part of the bigger picture of what actually the event loop does. async tasks are assigned to the thread pool and when finished their call back functions are put in the event queue. when nodejs's execution stack is empty, the event pool takes the first cb from the event queue and puts it back in the stack for execution

Collapse
 
ahmadawais profile image
Ahmad Awais ⚡️

Just edited my comment with the explanation/video — I hope it helps.

Collapse
 
cassiocappellari profile image
Cássio Santiago Cappellari

Thanks a lot for your feedback and, as a developer, I'm always looking forward to learning and improving my knowledge. I'll really appreciate suggestions about correct examples of Node.js diagrams in order to update my article, so feel free to share them!

Collapse
 
ahmadawais profile image
Ahmad Awais ⚡️ • Edited

I taught this as part of my premium Node CLI Development course, but just shared that 10min video on Node.js theory, publicly for free on my YouTube Channel here.

I hope it's helpful.

Collapse
 
ppicom profile image
Pere Picó

I found this talk from Bryan Hughes, Microsoft the best there is to understand the Node.js event loop

Collapse
 
cassiocappellari profile image
Cássio Santiago Cappellari

Thanks a lot for sharing this valuable content!