Multithreading vs Asynchronous Programming

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

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

  • @krithikabalu2235
    @krithikabalu2235 2 года назад +6

    Very well explained, thank you!
    I have a question, Does using await when calling the asynchronous function discard the advantage of asynchronous flow? What is the best way to call an asynchronous function?

    • @jawahar.nutshell
      @jawahar.nutshell  2 года назад +2

      Thanks Krithika for watching Nutshell. 😊
      Now to answer your question, asynchronous function behaves same no matter whether it’s been called using await or not. The purpose of asynchronous function is to return a promise which resolves in future. The await keyword is just a syntactic sugar.
      If the asynchronous function called with await, it only returns value after promise resolved (might take some time depends upon the function. So by this time execution goes to other parts of program).
      If the async function not called with await, you will immediately receive a promise object. You can attach a callback to it and get it executed once the promise resolved.
      Await is a convenient way to invoke asynchronous function especially to avoid callback hell.

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

      Thank you for the explanation..I had this doubt in my mind for a long time, now it's very clear :)

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

    Excellent Explanation. Thanks 👍

  • @ajay-vavdiya
    @ajay-vavdiya 10 месяцев назад +1

    You are underrated bro . I really admire the effort you put into your work. The quality of your content is truly exceptional.
    Keep it up.

  • @sabarish.vzabrz5688
    @sabarish.vzabrz5688 2 года назад +1

    Well explained in a nutshell👏👍

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

    Best video on this topic

  • @shobhamahadev118
    @shobhamahadev118 11 месяцев назад +1

    Useful video 👍

  • @jtv1972
    @jtv1972 Год назад +2

    Very good explanation!
    Clear, concrete!!!
    Thanks !

  • @isharamadushani47
    @isharamadushani47 5 месяцев назад +1

    well explained😍

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

    Very good explanation and Examples....go head with other videos' , thank you!

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

    Great concept video Jawahar 👏👏👏

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

    Great explanation of the concepts in a simple way.

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

    Should mention that the usage of thread pools is to eliminate the cost of thread creation for each request as it comes in; the threads in the pool are already created and awaiting usage

    • @jawahar.nutshell
      @jawahar.nutshell  2 года назад +1

      Yes exactly. The time taken and the compute power to create threads can be reduced by using thread pool with pre created threads.
      Thanks for watching Nutshell. 😊

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

      @@jawahar.nutshell Looking forward to more videos! thanks

  • @lokeshmnaik2875
    @lokeshmnaik2875 9 месяцев назад +2

    So in asynchronous programing all the 3 request handled by single thread?

    • @ibtehajali1035
      @ibtehajali1035 2 месяца назад

      Have you found answer?

    • @goumuk
      @goumuk Месяц назад

      yes, asynchronous programming is single threaded by nature.

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

    Nice explanation

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

    Great explanation with great example.

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

    The explanation is very clear.

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

    Nice explanations, thank you.
    Is multi-threading can be consider as one of the way to do parallel programming ?

    • @jawahar.nutshell
      @jawahar.nutshell  2 года назад +2

      Hi Kumaran
      Thanks for watching Nutshell. 😊
      Multithreading and parallelism differs based on CPU cores available.
      One CPU can do only one task at a time even if you do Multi threading. (seriously, believe me 😜). So when you do multithreading on a single CPU, it just gives an illusion of parallel execution by switching between multiple tasks quickly (very quickly beyond our imagination 😱)
      But parallel programming can be real (not just illusion 🙂) by utilising multi core processors. With multiple CPU cores, you can literally execute multiple tasks at the same time.
      Hope it answers your question.

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

      @@jawahar.nutshell Thanks again, please make a separate video explaining parallelism 🙂

  • @z-sckool
    @z-sckool Год назад +1

    Behtareen 👏👏 explanation

  • @TruptiaurKirankiDuniya
    @TruptiaurKirankiDuniya 4 месяца назад

    awesome explanation

  • @ShanthanReddyK-hl2zy
    @ShanthanReddyK-hl2zy 9 месяцев назад +1

    Thank you for the detailed explanation

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

    best video ever thx

  • @ShyamSunderReddy-t1s
    @ShyamSunderReddy-t1s Год назад +1

    superrrr sir

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

    too good explanation

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

    Nice explanantion

  • @sureshthaduri6275
    @sureshthaduri6275 6 месяцев назад

    so if we not maintain threadpool, created threads destroyed nd we can nt use right? if we create finte number of threads in thread pool we can re utilize thread right? but we all the theads are in use and we need another thread to process one task then how ??

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

    If one await methids Depends another await method result? Then how

  • @AshisRaj
    @AshisRaj 6 месяцев назад

    nice explanation

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

    Really a greate explanation with exact analogy but , still I have a question what is exact difference between asynchronous vs concurrency.

    • @shobhamahadev118
      @shobhamahadev118 9 месяцев назад +1

      asynchronous is a form of concurrency. By doing context switching btw the tasks we can achieve the concurrency.

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

    How many threads created in asynchronous?

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

      there is no threads will be created for asynchronous but wherever you write await task delay or some actions that is when in order to resume from that place statemachine will internally creates one new worker thread which is called as callback thread for the main thread. This callback thread will be created internally by TPL it doesn't cost any resource ulitilization as we are not creating new thread externally using Thread t1= new Thread (Method);
      Summary: Async does not use any threads.

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

      @@shobhamahadev118well explained

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

    Great explanation.

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

    Understood multi thread concept

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

    perfect explanation

  • @akshaygupta2167
    @akshaygupta2167 7 месяцев назад

    Very well explained
    Thanks.

  • @KungFuMonk69
    @KungFuMonk69 8 месяцев назад

    It was helpful, thanks

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

    Awesome

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

    Thank you sir

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

    thank you i have multi thread program which connects multiple IP cameras in a Network but it is hanging when Network down or some time so how to change to asychronous please help

  • @shafiq.hussain.cscore
    @shafiq.hussain.cscore Год назад +1

    Excellent

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

    Thanks that's helpful. But I still don't understand, say, in the boiler exmaple, if you only have one burner, you can't boil egg if you already boild milk, right? That happens with some single execution programs I am studying. How asychronous programming can be achieved in this case?

  • @riteshdavkare128
    @riteshdavkare128 6 месяцев назад

    very badly explained