Here's Why Node JS is NOT Single Threaded

Поделиться
HTML-код
  • Опубликовано: 3 июн 2024
  • Free Node JS Course: cdm.sh/nodejs
    ⚛️ Learn Full Stack Development: cdm.sh/fullstack
    Timestamps
    0:00 Teaser
    0:11 Video Starts
    0:44 Operating System Fundamentals
    1:45 LibUV
    2:42 Bcrypt function
    3:27 Node.js System
    8:07 Conclusion
    8:31 Outro
    👉 Free HTML5 + CSS3 Course: cdm.sh/htmlcsscourse
    👉 Free JavaScript Course: cdm.sh/jsbasicscourse
    👉 Free ReactJS Course: cdm.sh/react
    👉 Free NextS Course: cdm.sh/nextjsbasicscourse
    💰 Refer codedamn to friends and earn $$: cdm.sh/refer
    👉 Checkout codedamn on social:
    Instagram: cdm.sh/ig
    Twitter: cdm.sh/twt
    Facebook: cdm.sh/fb
    GitHub: cdm.sh/github
    If you found the video valuable, please leave a like and subscribe ❤️ It helps the channel grow and helps me pumping out more such content.
    👋 About Me:
    Hey! I'm Mehul Mohan, a CSE'21 graduate from BITS Pilani, Goa. I started coding early in life, at the age of 13 when I created my first blog on Blogger. I am listed in Google, Microsoft, Sony, eSet, etc. Hall of Fame for reporting vulnerabilities in their systems.
    🍎 I am Apple's WWDC'19 Scholar - visited San Francisco and attended WWDC.
    📙 I am an author of 2 books, on JavaScript and React - cdm.sh/mehulbooks
    🚀 Currently working on my own startup - codedamn.
    Connect with me:
    📸 Instagram: cdm.sh/mehulig
    📱 Twitter: cdm.sh/mehultwitter
    📝 LinkedIn: cdm.sh/mehullinkedin
    📂 GitHub: cdm.sh/mehulgithub
    🌎 Personal website: cdm.sh/mehulblog
    💻 Start learning to code for free: cdm.sh/codedamn
    🧑‍🤝‍🧑 Discord community: cdm.sh/discord
    👉 HTML5 + CSS3 Tutorials: cdm.sh/htmlcssytplaylist
    👉 Complete JavaScript Tutorial: cdm.sh/jstutorial
    👉 Complete React Crash Course: cdm.sh/reacttutorial
    👉 Next JS Tutorials: cdm.sh/nextjsytplaylist
    🏷 Video Tags:
    Node JS is NOT Single Threaded | Here's Why
    nodejs
    node tutorial
    node js tutorial
    node.js tutorial
    nodejs tutorial
    learn node.js
    learn nodejs
    node js
    node.js
    what is node.js
    what is nodejs
    node js tutorial for beginners
    node js crash course
    👉 Check out my other personal RUclips channel (it is in Hindi/English mix) where I share coding tips, tricks, and hacks: cdm.sh/mehulyt

Комментарии • 75

  • @devorein
    @devorein 2 года назад +12

    The breadth of topics you cover is jaw-dropping. Always look forward to your videos.

  • @mayursonawale475
    @mayursonawale475 2 года назад +5

    This is really perfect and detailed version of background processing while using node js.
    Saw it once, now it's printed in my brain 🔥.
    Thank you so much for this video and looking forward a great learning curve with you.

  • @enlightened3945
    @enlightened3945 2 года назад

    This is too good! I have recently been watching your videos. Thanks and respect to your hard work.

  • @indurkar4338
    @indurkar4338 2 года назад +2

    The explanation you give for everything including NodeJS Multi Thread, CORS, Networking Basics etc is Amazing. Due to your videos I can understand these concepts clearly. Keep making such wonderful videos for us.

  • @eyeamkd
    @eyeamkd Год назад

    Amazing video. Loved it to the “core”

  • @daimoncardenas5074
    @daimoncardenas5074 2 года назад

    You are expert in Javascript. Thanks Engineer. Regards.

  • @madannikalje760
    @madannikalje760 Год назад

    This is exactly what I was thinking... Thank you so much

  • @rasikaraja1840
    @rasikaraja1840 9 месяцев назад

    I watched this video till end. Great content.

  • @VishnuVijai_
    @VishnuVijai_ 2 года назад

    Thank you so much this must be relevant with all Web server : instances configurations.

  • @balaganesh3440
    @balaganesh3440 Год назад

    Astonishing explanation..

  • @abhishekvishwakarma9045
    @abhishekvishwakarma9045 2 года назад

    Great content as always ✌🔥

  • @jayjani740
    @jayjani740 2 года назад +1

    Your explanation is pretty much clear for me. Thanks alot :)
    Can I get some animated stuff of these process?
    Would really help me and others like me alot. :D

  • @munishthakur8018
    @munishthakur8018 2 года назад

    Wonderful Explanation!

  • @subhankardas7207
    @subhankardas7207 2 года назад

    Awesome !!
    Thanks a lot !
    " I watched this video till the end "

  • @FaruqHameed-sl9gq
    @FaruqHameed-sl9gq Год назад

    I watched this till the end. Thanks

  • @debrajash9376
    @debrajash9376 10 месяцев назад

    Awesome Explanation

  • @justcurious1349
    @justcurious1349 2 года назад

    Really nice content man... 👌

  • @rokibDev
    @rokibDev 2 года назад

    Great explanation ❤️

  • @fullStackInKannada
    @fullStackInKannada 9 месяцев назад

    Nice, thank you!

  • @eswarprasad9773
    @eswarprasad9773 9 месяцев назад

    if the Libuv thread pool gets hold of all the cores in our system, how does a separate nodejs process like cluster or pm2 instance run a different process with its own libuv thread pool and main thread ??

  • @jijin2450
    @jijin2450 2 года назад +4

    I watched this video till end 🏃🏃🏃

  • @firdousbhat123
    @firdousbhat123 2 года назад

    We have now async in python as well. FastAPI works somewhat similar to the Node js.

  • @andreigatej6704
    @andreigatej6704 2 года назад +1

    Thanks for the great video.
    Did you actually dive deep into libuv's source code? Would be very interesting to see some videos where one points out how things really take place under the hood.

  • @devab1142
    @devab1142 Год назад

    Thanks man ❤️

  • @arvindshelke8889
    @arvindshelke8889 2 года назад

    I watched this video till end.
    Came to know about libUV👌👌

  • @Valhgg
    @Valhgg 2 года назад

    Thank you!

  • @HimanshuChoudhary-smartfire
    @HimanshuChoudhary-smartfire 2 года назад

    I always watch 👀 your video till the end.

  • @gourabmukherjee2169
    @gourabmukherjee2169 9 месяцев назад

    This concept seems more like what nodejs provides as worker threads for a compute heavy system. Is the concept same for IO intensive tasks as well? My question is which part exactly is responsible in os watching for a db query to be fulfilled?

  • @vladimirhodan7360
    @vladimirhodan7360 Год назад

    Wouldnt be better initialize more node workers with less libuv threads to better utilization of processor for parallel requests processing priority?

  • @programmersoham
    @programmersoham 2 года назад

    I watched Till the End really informative video

  • @rafarolsky7522
    @rafarolsky7522 2 года назад

    just great :) thx

  • @Atif1702
    @Atif1702 2 года назад

    who will be placing the requests in thread pool to cores? Thread Pool or Scheduler?
    Because in the diagram you made, it shows that thread pool is putting it on cores.

  • @Growlboy1986
    @Growlboy1986 2 года назад

    I watched this video till the end :D

  • @rankersfundae6884
    @rankersfundae6884 11 дней назад

    for example 500 request comes....and each has to perform 10 task and some task's code may be synchronous and some task's code is asynchronous......as node js is single threaded it will put of all the request in a queue..it takes out 1 request and that request is to run 10 task .....out of which say 4 task'code are asynchronous so that 4 task command will go to thread pool right?....remaining 6 task is performed and result is generated.....now when the 4 lines asynchronous task result is generated the all 10 task result is clubed and response is send ...then for request 2 same thing happens.....so why we say node js can handle multiple request at a time.......or is it like when request1 6 sync task is completed......the other 6 task of request 2 starts to get executed even though request 1 4 async task has not completed so node js is making the request run concurrently and not parallely this shows the single threading nature....if for suppose node js might have been multi threading that we could have access multiple request parallely......am i getting it correct?

  • @anuraghazra4772
    @anuraghazra4772 2 года назад +1

    Underrated channel. 🔥

  • @bhumit070
    @bhumit070 2 года назад

    Hey nice explaination , can you make long videos like hussein ?

  • @bhavinpatel1425
    @bhavinpatel1425 2 года назад

    As 1 request take 1 second for process + 1 second for callback = total 2 second. What about 500 request, for this example as we have 4 thread OS. What is total time to complete the execution for 500 request?
    Could you please assist for this?
    Thank you.

  • @arpanghoshal2579
    @arpanghoshal2579 2 года назад +3

    Great explanation.
    Does this only happen for something like a C++ binary? Can I make use of multithreading when writing normal javascript code in node js, I believe when we use promises it just uses the event loop which is concurrent but not parallel so it is still utilizing only a single core of our cpu.

    • @electrolyteorb
      @electrolyteorb Год назад

      Just learn Go
      (With a grain of salt)

    • @arpanghoshal2579
      @arpanghoshal2579 Год назад +1

      @@electrolyteorb Yes Go lang is great, though I haven't used it yet. I mainly work with Elixir which is very good at concurrent or parallel processing.

  • @himanshulal97
    @himanshulal97 2 года назад

    Sir teell mee from where did u got this much in depth Concept, I must say I been working with node for two years but do not got that this deep apology that took behind the scenes 😀😀😀 sir plz 🙏 refer me some this that could connect me to that level of deepness and personally I felt something is missing and by this video I come to know that there's a lot more to learn in node 😀😀😀 plz refer some book wher u prefer to have this much deep Concept...

  • @shashikantkalshetty
    @shashikantkalshetty 2 года назад

    Watched till the end

  • @hellofriend3091
    @hellofriend3091 2 года назад

    Please cover middleware

  • @yveszavel6234
    @yveszavel6234 2 года назад

    Watched to the end

  • @chrisplusplus6232
    @chrisplusplus6232 2 года назад

    i remember a twitter argument similar to this few weeks ago from oliverjumpertz

  • @RafaelSFTech
    @RafaelSFTech 10 месяцев назад

    Nice!

  • @rohan1765
    @rohan1765 2 года назад +1

    I watched this video till the end.

  • @shashankkr1008
    @shashankkr1008 2 года назад

    Watched this till the end

  • @JafferAliTalks
    @JafferAliTalks 2 года назад +1

    I watched videos till end

  • @rituparnaw
    @rituparnaw Год назад

    But this is about bcrypt which executes on a c++ binary. Can you please tell how do JavaScript inbuilts, like promises specifically work. Suppose there are 5 promises.... ho do these 5 promises get executed parallelly ? @codedamn

    • @eswarprasad9773
      @eswarprasad9773 9 месяцев назад

      All the async ops including promises get offloaded from node main thread which is basically running v8 engine.
      You have to understand that async ops usually involve low level tasks . If you take a network call , you have to access the network card of the hardware. all these go to the libuv thread pool which executes them just like bcrypt. Once done they come to the callback queue and event loop pushes them to main thread one by one.
      Also we have to remember
      Nodejs works by concurrency
      Libuv works by parallelism

    • @rituparnaw
      @rituparnaw 9 месяцев назад

      thank you so much for the explaination
      @@eswarprasad9773

  • @soorajs577
    @soorajs577 2 года назад

    I watched full video

  • @puneetsingh9678
    @puneetsingh9678 2 года назад

    I watched this video till the end

  • @Raj-iz9uz
    @Raj-iz9uz 2 года назад +1

    Mehul Sir same Content Post in Hindi also here or in ur Mehul Mohan Channel it will definitely Boost both Channel's 🔥🔥🔥

  • @user-qu1xh6me5e
    @user-qu1xh6me5e 2 года назад

    I WATCHED THIS VIDEO TILL THE END

  • @maacpiash
    @maacpiash 2 года назад +1

    Node.js itself is not single-threaded. The Javascript program that we write to run on Node.js is single-threaded.

  • @vmmoorthi
    @vmmoorthi 2 года назад

    I watched till end

  • @muhammedladeed2280
    @muhammedladeed2280 2 года назад

    i watched this video till the end

  • @DebdutBiswasOnline
    @DebdutBiswasOnline 2 года назад

    awesome

  • @amolchourasia6180
    @amolchourasia6180 2 года назад

    I watched this video till end.

  • @ayushthakur8703
    @ayushthakur8703 Год назад

    great

  • @sumer9999
    @sumer9999 2 года назад

    Hey the JS main thread is still single and if that's stuck in processing your event loop would be stuck and whole application would either be stuck or crash.

    • @eswarprasad9773
      @eswarprasad9773 9 месяцев назад

      Thats why you never write data intensive ops on the main thread,
      You can spawn a worker thread for you do it and share the data with parent. If its async you anyway will pass it to libuv or web api in case of a browser

  • @cloud_architector
    @cloud_architector 2 года назад

    Nice

  • @donmikkodanm.olmillo8154
    @donmikkodanm.olmillo8154 2 года назад

    I WATCHED THIS VIDEO TILL THE END! 😊

    • @donmikkodanm.olmillo8154
      @donmikkodanm.olmillo8154 2 года назад

      so basically, the more CPU cores you have the more libUV can schedule it to each core?
      16 cores = 16 hashing process it can take in parallel?

    • @codedamn
      @codedamn  2 года назад +1

      correct

  • @muhammedladeed2280
    @muhammedladeed2280 2 года назад +1

    👌👌

  • @himanshulal97
    @himanshulal97 2 года назад

    And video ends soon didn't noticed 🤣🤣🤣

  • @ahmedhafez9951
    @ahmedhafez9951 Год назад

    Great explanation, but the background music is really annoying

  • @friendofzeus
    @friendofzeus 10 месяцев назад

    I recommend you remove the background music.

  • @samhanna7382
    @samhanna7382 2 года назад

    Have some sleep tho

  • @Hackkit
    @Hackkit 2 года назад +1

    What a sad face wala kidding ismail ...!!!

  • @bramlachat2515
    @bramlachat2515 2 года назад

    I watched this video till the end