Node.js Tutorial - 42 - Event Loop

  Рет қаралды 116,441

Codevolution

Codevolution

Күн бұрын

Пікірлер: 96
@pigra24
@pigra24 Жыл бұрын
One of the best high-level explanation of the event loop, ever!! Thank you so much for this.
@dontargetme2416
@dontargetme2416 Жыл бұрын
This content is gold, hope you're planning for the cluster module and (exec, spawn, fork) with deep explanation in your next vods
@nagarjundeepak
@nagarjundeepak 10 ай бұрын
this is by far one of the brilliantly articulated video out there that too for free wrt node js event loop... thanks a ton
@watherby29
@watherby29 Жыл бұрын
You are literally the only person that, when explaining, makes me remember all I listened and watched. Amazing. Don't know how you do it. Thank you.
@BorgMater
@BorgMater Жыл бұрын
Was about to say the same thing!
@bassam.2023
@bassam.2023 Жыл бұрын
What don't you get? Vishvas is a Master teacher, that's why.
@nandannandan5910
@nandannandan5910 Ай бұрын
yes I have same experience
@celestenzeza520
@celestenzeza520 5 ай бұрын
I think there's a mistake around the 11:32 mark on step number 3. Based on my understanding, If a task in the timer queue (or any macrotask queue) enqueues a microtask (say you have a promise inside a setTimeout callback) the event loop will not execute the other macrotasks in that queue and start executing from the microtask queue until it is empty again.
@celestenzeza520
@celestenzeza520 5 ай бұрын
this code snippet prints 1, 2, 3, 4, 5, 6 function main() { console.log('1'); setTimeout(() => { console.log('3'); // this is a microtask within the callback of a macrotask process.nextTick(() => { console.log('4'); }); // this is a macrotask within the callback of a macrotask setTimeout(() => { console.log('6'); }, 0); }, 0); setTimeout(() => { console.log('5'); }, 0); process.nextTick(() => { console.log('2'); }); } main()
@abdulhashik
@abdulhashik 6 ай бұрын
It’s better to show the order of execution or priority in the diagram itself
@adehenry9591
@adehenry9591 Жыл бұрын
Thank you Vishwas 🙏🏾
@BRUNANAIANMOREIRALIMAGARCIA
@BRUNANAIANMOREIRALIMAGARCIA 5 ай бұрын
That was very well explained, thank you
@lilitmazmanyan1873
@lilitmazmanyan1873 Жыл бұрын
THANK YOU VERY MUCH FOR THE COURSE!! Best explanation yet.
@yasmeinSalem44
@yasmeinSalem44 2 ай бұрын
it's the best explanation, thank you so much
@Николай-г5т6ч
@Николай-г5т6ч Жыл бұрын
Many thanks. How many videos are planned for this playlist?
@ashwathshetty4227
@ashwathshetty4227 Жыл бұрын
What will be the order of execution if we have setImmediate and setTimeout(fn,0) @codeevolution
@DuckpoolOfficial
@DuckpoolOfficial 2 ай бұрын
waiting for express js tutorials
@JishnuGeeks
@JishnuGeeks 2 ай бұрын
Bro You mistakenly said js is blocking but JavaScript itself is not inherently blocking or non-blocking; it depends on how it's used in different environments. In the context of web browsers, JavaScript traditionally operates in a non-blocking manner, especially when handling asynchronous tasks like fetching data from a server. However, JavaScript code can be written in a blocking manner if operations are performed synchronously without utilizing asynchronous capabilities. The other lecture is good, keep it up
@NeuronEnix
@NeuronEnix 3 ай бұрын
setImmediate seems to run before setTimeout, does that mean check queue is executed first before timer queue ? I'm on node v20.14.0 setTimeout(() => console.log("timeout")) setImmediate(() => console.log("immediate")) ouput: immediate timeout
@muhammadwaqar-u5e
@muhammadwaqar-u5e 3 ай бұрын
just watched 4:30 and i already your fan sir... you got my sub, my support and lots of love (^_^)
@AliRaza-ru6fx
@AliRaza-ru6fx Жыл бұрын
visual representation is more effective than explaining thing without it. Thanks @vishwas sir.
@fawwadk1
@fawwadk1 2 ай бұрын
Does promise queue is same as promise function of javascript?
@soumadip_banerjee
@soumadip_banerjee 11 ай бұрын
HOW TO GET HOLD OF YOUR SLIDES? PLEASE PLEASE PLEASE REPLY ❤
@ImAkid-ss5pb
@ImAkid-ss5pb 11 ай бұрын
Best nodejs playlist I ever came across youtube
@AhmedMohammed-ks8uo
@AhmedMohammed-ks8uo Жыл бұрын
Thank you, Vishwas for this fantastic course. you are always the best choice to explain any topic
@shantanusinha3609
@shantanusinha3609 3 ай бұрын
Great explanation!
@AHMED-nd7zt
@AHMED-nd7zt 4 ай бұрын
that was really nice
@onlineofathing9351
@onlineofathing9351 8 ай бұрын
You said javascript is synchronous but the new javascript - ES6 uses async functions? Am a bite confused
@nishantsatere9350
@nishantsatere9350 3 ай бұрын
GODDDDDDDDDDDDD
@PavloChykin
@PavloChykin 10 ай бұрын
Great explanation, but isn't it a mistake in 11:20? "All callbacks within the timer queue are executed" - is it true? Not only limited amount of them?
@deepcrashcourse
@deepcrashcourse Ай бұрын
Thanks
@ManiKandan-i5v
@ManiKandan-i5v Жыл бұрын
console.log("Start"); setTimeout(() => { console.log("Timer Callback 1"); }, 1000); setTimeout(() => { console.log("Timer Callback 2"); }, 500); const fs = require('fs'); fs.readFile('example.txt', (err, data) => { if (err) { console.error("I/O Callback (Read File) Error:", err); } else { console.log("I/O Callback (Read File)"); } }); setImmediate(() => { console.log("Immediate Callback"); }); console.log("End"); when im trying to run this code timer queue callbacks running after all the callbacks why according to priority timer queue should run first right
@HEAVYMETAL80tas
@HEAVYMETAL80tas 7 ай бұрын
Waaaoo!! Is a great experience to watch this just like a good movie.. It is so entertaining and digestable for this articulated concept. Is very enjoyable to have this understanding, how everything fits! 👌🍿🔥
@Maijiddakhadija
@Maijiddakhadija Жыл бұрын
Gooo job however, i will be glad if you can use explain the last-in-first-out principle using the console
@sidhantkumarsingh2
@sidhantkumarsingh2 18 күн бұрын
.
@mitalisingh533
@mitalisingh533 5 ай бұрын
The best explanation i ever watched of this topic. I have been facing a lot of trouble lately understanding javascript's async behaviour. I think i am gonna find the solution here only. Too good. Really appreciable.
@mostinho7
@mostinho7 Жыл бұрын
8:30 the event loop visualization and the different queues inside it
@morpheusmatrix1073
@morpheusmatrix1073 Жыл бұрын
Liiiii__Buuuu__V_________ 😀 ! Loved it ! Man thanks for this explaiation ! 👍
@quannguyenhoang2481
@quannguyenhoang2481 Ай бұрын
the second time watching this video after one week and getting know well. Thank you a lot
@lekhiem7572
@lekhiem7572 10 ай бұрын
The cycle diagram appears to be outdated. I would recommend referring to the official site for an updated explanation, which is provided below: - A process.nextTick callback is added to process.nextTick queue. A Promise.then() callback is added to promises microtask queue. A setTimeout, setImmediate callback is added to macrotask queue. - Event loop executes tasks in process.nextTick queue first, and then executes promises microtask queue, and then executes macrotask queue.
@prateek1369
@prateek1369 9 ай бұрын
could you pls point me to some reference that talks about this change. I'm very confused rn
@skumarwebdev
@skumarwebdev Жыл бұрын
Well researched video. No video of event loop on youtube told me that the libuv is just a C program. Nice.
@stanleyhayford6881
@stanleyhayford6881 Жыл бұрын
I swear I love you. I'll learn anything you teach. Now I can picture the event loop. I'm happy. I'm just walking around and laughing
@mertfromhell
@mertfromhell Ай бұрын
gay
@RehanKhan-xf3ml
@RehanKhan-xf3ml 6 ай бұрын
You are the best 💡 I saw a lot of vids and tuts but this demonstration is simply amazing
@jasbrar7301
@jasbrar7301 Жыл бұрын
Hi Vishwas, thanks for the amazing content. Looking forward to the Express course, when are going to drop it?
@DanZ-fq2qs
@DanZ-fq2qs Жыл бұрын
Thanks for the video! I need to point out that Execution order is incorrect. The micro task queue will not wait for all callbacks within the timer queue are executed. Instead for Node 11+ nextTick callbacks and microtasks will run between each individual setTimeout and setImmediate callbacks, even if the timers queue or the immediates queue is not empty.
@curios_bot
@curios_bot Жыл бұрын
Yes, I tested this.
@watherby29
@watherby29 Жыл бұрын
I am wondering how those tasks in the low-priority queues are executed at all
@Quoccute854
@Quoccute854 5 ай бұрын
Best nodejs event loop explanation, thank you 😍
@rokckerzzzz6080
@rokckerzzzz6080 Жыл бұрын
Very informative video with visual representation and it's explanation. Thank you
@dixitsathwara6576
@dixitsathwara6576 Ай бұрын
This is the best explanation of nodejs event loop
@RamKumar-es3mp
@RamKumar-es3mp Жыл бұрын
Great content. Please upload RXJS videos please
@josephchukwu6088
@josephchukwu6088 Жыл бұрын
Thanks a lot sir Vishwas,ypu're an incredible teacher
@SabarivasanSankar
@SabarivasanSankar Жыл бұрын
What about the events created by eventemitter there is no details about it
@js_programmer8423
@js_programmer8423 Жыл бұрын
variables are stored on the call stack, not the memory heap.
@RajYadav-fy4lm
@RajYadav-fy4lm Жыл бұрын
just wanted to ask what would be the last topic fo the event loop playlist?
@shineLouisShine
@shineLouisShine Жыл бұрын
Impressed by the flawlessly flowness of teaching.
@swapnil511994
@swapnil511994 5 ай бұрын
you are a god in a mortal's body. the best explanation till date
@jogre900
@jogre900 Жыл бұрын
Sr can you do a series about SOLID pirnciples on a react app please?
@shubhamkareer
@shubhamkareer 9 ай бұрын
The way yo taught this process of event loop amazed me. Hats off to your skills.
@yotajm1982
@yotajm1982 Жыл бұрын
amazing, best explaination ever!...
@rishiraj2548
@rishiraj2548 Жыл бұрын
🙏🙏
@균서
@균서 4 ай бұрын
설명 진짜 개쩐다 말이 안됨... 이사람은 신이야
@rishabh010189
@rishabh010189 Жыл бұрын
Hey, I have a question - for any queue other than the Microtask queue will the event loop wait for it to finish with all of its callbacks before checking in with the Microtask queue, or will it check the Microtask queue after when each and every callback is executed and popped off from the call stack. Considering the call-stack is now empty, it should ideally check with the Microtask queue first before picking up any other cb() from the other queues. Hope, I am able to explain my question. Thanks.
@rishabh010189
@rishabh010189 Жыл бұрын
I got my answer from the following sessions, so please ignore. Although I think this video @11.37 seconds needs to be corrected as it says in point no #2,#4,#6,#8 seems a bit misleading to me
@AhmedShahriarAdnan
@AhmedShahriarAdnan 4 ай бұрын
best explanation of event loop to date. no one does better.
@cl-7832
@cl-7832 7 ай бұрын
Hands down the best presentation on this topic! Wow! Thank you.
@himanshupoddar1395
@himanshupoddar1395 Жыл бұрын
NodeJS be like: Yeh toh Dhoti khol raha hai
@owethuweek6283
@owethuweek6283 Жыл бұрын
Thank you, thank you! You are a star and you have earned a subscriber. Well explained and I now have the required confidence to understand as to what is going on the event loop.
@raghavenderkuppireddy7158
@raghavenderkuppireddy7158 4 ай бұрын
Beautiful explanation ❤❤❤❤❤
@huydang277
@huydang277 Жыл бұрын
Wonderful work, sir. I read some article in internet and noone more clear than your video. Thank you so much
@ehza
@ehza Жыл бұрын
Oh damn! This is useful
@gauravbisht1949
@gauravbisht1949 Жыл бұрын
Great knowledge sharing video
@muthu1046
@muthu1046 Жыл бұрын
Thanks!
@cryptomambaindia2645
@cryptomambaindia2645 Жыл бұрын
Great explaination on event loop!! Thank you.
@yashgaur1716
@yashgaur1716 Жыл бұрын
That was some great explanation
@asifmulla9308
@asifmulla9308 Жыл бұрын
Great explanation sir..😍😍😍
@vinay3191
@vinay3191 Жыл бұрын
you have mentioned setTimeout and setInterval callbacks are given first priority, but actually.......... In the Node.js event loop, the execution of setTimeout and setInterval callbacks is not given first priority. These callbacks are enqueued in the event queue after their specified delay or interval, and they are not immediately executed when their time is up. Instead, they will be executed only when the event loop has the opportunity to process them.
@chetankumar9463
@chetankumar9463 Жыл бұрын
Also he said that synchronus code will always run before async code. That's why call stack needs to run synchronus code first. When stack got empty then event loop will start to push async code.
@loveutube04
@loveutube04 11 ай бұрын
The event loop works in a loop... Recall the diagram..setTimeout and setInterval are given first priority but even loop works in a loop..if it is in the middle of the evvent loop, the timeout events have to wait till loop is complete and their turn comes
@LearnWithJK03
@LearnWithJK03 Жыл бұрын
Thanks a lot 🙏
@frontend_ko
@frontend_ko Жыл бұрын
thanks teacher, 42 it was great!
@abhishekvishwakarma9045
@abhishekvishwakarma9045 Жыл бұрын
really great representation and explanation 😎 awesome as always
@boopfer387
@boopfer387 Жыл бұрын
wow thanks again
@Shivam-sl4sp
@Shivam-sl4sp 10 ай бұрын
Thanks man!!
@caaltz
@caaltz 9 ай бұрын
this course is a treasure
@vintiray6251
@vintiray6251 Жыл бұрын
great explanation
@pradneshkhedekar5279
@pradneshkhedekar5279 Жыл бұрын
Really great explanation and on point with visual representation 👍
@AlaminHossain-hf2gv
@AlaminHossain-hf2gv Жыл бұрын
Helpful video
@amolagarwal5336
@amolagarwal5336 11 ай бұрын
The best explanation I have ever had on the event loop. you rock Vishwas. Thanks for the video
@dannnsss8034
@dannnsss8034 3 ай бұрын
Do you really need to understand all of this? I just have to 'know node' for work. I'm thinking of skipping these Event Loop videos, go straight to the NPM videos.
@-UCA-SAAMSHERONJ
@-UCA-SAAMSHERONJ 2 ай бұрын
Your loss
@shekhar5051
@shekhar5051 Жыл бұрын
Redis Series please 🙂!
@BruceWayne-kw6xm
@BruceWayne-kw6xm 9 ай бұрын
The Only Best Video On KZbin or in any paid video about the explaination of event loop... hats off to vishwas 🫡🫡🫡🫡
@swatijain1809
@swatijain1809 Жыл бұрын
Just one word for you AWESOME🥸
Node.js Tutorials - 43 - Microtask Queues
14:30
Codevolution
Рет қаралды 46 М.
10 JavaScript Interview Questions You HAVE TO KNOW
13:41
James Q Quick
Рет қаралды 61 М.
Win This Dodgeball Game or DIE…
00:36
Alan Chikin Chow
Рет қаралды 37 МЛН
100 Identical Twins Fight For $250,000
35:40
MrBeast
Рет қаралды 44 МЛН
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 20 МЛН
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 10 МЛН
Event loop в Node.js
33:45
EPAM Moscow ITsubbotnik
Рет қаралды 44 М.
Node.js Event Loop Explained
10:26
Software Developer Diaries
Рет қаралды 6 М.
JavaScript Visualized - Event Loop, Web APIs, (Micro)task Queue
12:35
When is NodeJS Single-Threaded and when is it Multi-Threaded?
18:42
Hussein Nasser
Рет қаралды 72 М.
Node.js Tutorial - 45 - I/O Queue
11:18
Codevolution
Рет қаралды 25 М.
Win This Dodgeball Game or DIE…
00:36
Alan Chikin Chow
Рет қаралды 37 МЛН