Threading In C++ | Complete Course

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 พ.ย. 2024

ความคิดเห็น • 101

  • @paulallen8597
    @paulallen8597 10 หลายเดือนก่อน +4

    I'm glad I found this video. I've been a JEE developer for over a decade so the last time I used C++ was when the only option for threads was the pthread library. With my new job as a Principal Software Engineer, I needed to get a fast refresher on C++ especially for multi-threaded applications (heavily multi-threaded - hundreds of threads and processes). This is doing the job nicely.

  • @markusbuchholz3518
    @markusbuchholz3518 3 ปีที่แล้ว +57

    I would like to highlight again that knowledge you captured and your ability in sharing your "odyssey" with community has been for sure created, approached throughout many years of experience, studying, solving problems and sitting alone at the front of PC. We need all to remember that these 4 hours of current beauty means many thousands (I suppose) for Rupesh. Thank

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +12

      Hi Markus, Thanks for such a nice comment.
      Yes it was thought many time and took so much to find examples so that it would be clear to everyone.

    • @SonaliProgrammingHub
      @SonaliProgrammingHub 2 ปีที่แล้ว

      Nice video. For complete series of multithreading, visit my channel: th-cam.com/video/cZEO2UoEJNE/w-d-xo.html

  • @trunghieu8538
    @trunghieu8538 3 ปีที่แล้ว +9

    Best course i've ever learnt. I've watched it continuous 4 hours without break. It's no boring at all. Thanks for your great.

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +2

      Thanks..

    • @RTMgi9
      @RTMgi9 ปีที่แล้ว +1

      You have the power that people desire and don't have. I wish I could listen for that long.

  • @yea-yea
    @yea-yea 2 ปีที่แล้ว +2

    Hello CppNuts, this channel has been what I have been looking for a long long time as a (almost) senior C++ software engineer. The videos in the channel are more than dry and monotonous regular C++ tutorials on the internet. They are most of the time great refreshers about the topics in language even if you have decades-long experience in this field.
    I would like to thank you again wholeheartedly for putting out this much work in such quality. Have a nice day and keep it up! Cheers.

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Thank you so much.

  • @walidkhames1966
    @walidkhames1966 10 หลายเดือนก่อน +1

    A great comprehensive tutorial.

  • @treyquattro
    @treyquattro 3 ปีที่แล้ว

    a collection of Rupesh's Greatest Hits (threading version) is always a welcome treat!
    FYI, regarding lock(m1, m2, ...) (2:50:46): I checked the STL code (GNU C++ compiler 8, C++17) - there is no timed back-off nor rearranging the order of mutexs: lock stays in a loop until it grabs all the mutexs for as long as it takes to acquire them all, in the order that they were presented in the call to lock().

  • @pranavkumar1543
    @pranavkumar1543 3 ปีที่แล้ว +4

    I have been looking for good understanding source to study threads in cpp. And indeed this video series is the one which quenched my basic learning for thread. I am confident with threads now. 😊

  • @therockerrush
    @therockerrush 3 ปีที่แล้ว +4

    I recently discovered this channel and you're too good man, you just keep giving. What an amazing resource!

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Thanks dude..

  • @yashaswinip4633
    @yashaswinip4633 3 ปีที่แล้ว +5

    Your videos are a life saver. Thank you so much from the bottom of my heart for helping out students and interview go-ers.

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Welcome

  • @RushFuture
    @RushFuture ปีที่แล้ว

    3:55:18 - mutex *mu* will be locked only once with *locker* ctor on entering the scope, but next loop iterations will not call *locker* ctor! Function std::condition_variable::wait() will fail postconditions ( *locker.owns_lock()==true* and *locker.mutex()* is locked by the calling thread) on next iteration and *std::terminate* will be called. There are no need to unlock the mutex because *wait()* do it for you. Remove line 20 *locker.unlock()* and you will be fine.

  • @irida_vz
    @irida_vz 2 ปีที่แล้ว

    just to add in section of condition variable - when you wait on the mutex while giving a predicate (here lambda function), it also evaluates to check if that is true. In this case if your balance was not 0 for the very first time, the condition variable will not wait on the lock and proceed further execution.

  • @sudhanshushekhar4222
    @sudhanshushekhar4222 26 วันที่ผ่านมา

    Amazing explanation cpp nuts..🎉🎉

  • @udaspd123
    @udaspd123 2 ปีที่แล้ว

    This is the best video I have ever seen for multi threading where all the basics are explained with real life example which makes easier to understand complexity. I have watched all 4 hours of video and I would highly recommend this . Rupesh sir teaching is like professor teaching in a class like the money heist professor 😀. I have one more request . If possible please arrange gRPC client and server in C++ using asynchronous .gRPC is a google standard protocol for client server communication but there is very less material available for c++ particularly for bidirectional streaming of client and server using asynchronous mechanism .
    where complex multi threading is used. Thanks a lot again for multi threading session. It really helped a lot.

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Thanks Pranva Udas for such a nice comment, really encourages.

  • @adityalenka1499
    @adityalenka1499 3 ปีที่แล้ว

    I don't know about this awesome channel to learn c++ ,what are the contents are provided by you sir it is too good and these lecture videos are very much valuable for me ,thanks for providing these type of contents.🙏

  • @shivaprasad8142
    @shivaprasad8142 3 ปีที่แล้ว +1

    I'd like to add another point related to the "Producer-Consumer" problem, it's not mandatory that both producer & consumer notify each other, There is a very good chance that the Producer blocks the incoming data received is too fast or heavy over a socket or within the process, its recommended to continuously keep track on buffer size(Rather than waiting on consumer signal) at one end and notify the consumer

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Video just explain a way, there can be multiple ways.

  • @rajeshgalla12
    @rajeshgalla12 2 ปีที่แล้ว +1

    Thank you for a such a wonder full session. There was a interview question around threads, Since threads by default welcomes running conditions. We have to sufficiently test the code before release it to Production. However how much of guarantee ness we will provide either as part of code review OR unit testing we will make sure all running conditions are been tested. No missing conditions will happen in Production. I have googled there are couple of tools where they execute all permutation and combinations but just want to know your thoughts.

  • @rushabhlegion2560
    @rushabhlegion2560 17 วันที่ผ่านมา

    Day1 : 58:56
    Day2 : 2:02:13

  • @bittupandey6645
    @bittupandey6645 3 ปีที่แล้ว

    3 hr 55 mins thread ka Pura Gyan Mila awesome content !! fun moment dogs barking at the back -> That is not my doggy 😂😄

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      I remember that too 😂

  • @darshangupta1436
    @darshangupta1436 ปีที่แล้ว

    Amazing! Your knowledge and teaching skills are brilliant!

    • @CppNuts
      @CppNuts  ปีที่แล้ว

      Thanks Darshan

  • @pawanlok1776
    @pawanlok1776 ปีที่แล้ว

    Thank you for creating this long video.

  • @varmorapratik8858
    @varmorapratik8858 11 หลายเดือนก่อน

    Hi Rupesh, Can u please post your blog link. So that I can get code snippets..Your videos are OSM and very helpful.

  • @mona3abhi
    @mona3abhi 3 ปีที่แล้ว

    Thank you Rupesh.It is so helpful.

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Thanks for watching..

  • @grigoriyz
    @grigoriyz 3 ปีที่แล้ว +1

    Excellent lecture! Thank you! However, you forgot to mention function yield()

  • @mandibozo1294
    @mandibozo1294 ปีที่แล้ว

    Hi, thanks for your content! It's been really helpful. With the first example when I use threads the program actually takes longer. I have a Ryzen 5000 series CPU so I definitely have more cores available as that was a common point people in forums had pointed out.

    • @CppNuts
      @CppNuts  ปีที่แล้ว

      Please check other comments I have pined important comments to resolve it.

  • @nichenametlasreevidya9704
    @nichenametlasreevidya9704 ปีที่แล้ว

    Thanks for making this video very useful to me. Can i know where can i get the code used in these videos

  • @vikramhon6779
    @vikramhon6779 2 ปีที่แล้ว

    You are just awesome man.. Keep going

  • @umanshibakshi3856
    @umanshibakshi3856 2 ปีที่แล้ว

    Excellent tutorial. Would be helpful if you could also provide links to the code in the description. Thanks.

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      It’s there in channels About page.

  • @ivantmib1596
    @ivantmib1596 ปีที่แล้ว

    Thanks very well explained.
    Perhaps could be nice to cover std::atomic as well?

    • @CppNuts
      @CppNuts  ปีที่แล้ว

      Sure..

  • @arpitagupta4997
    @arpitagupta4997 2 ปีที่แล้ว

    In std::lock example 4 , can you please explain why there could be deadlock. Since locking is thread dependent and not depends on lock() function, t1 can release M1 and M2 to avoid deadlock.

  • @amitgupta-or5nm
    @amitgupta-or5nm 3 ปีที่แล้ว

    once in a interview i was how to design thread ........................so is this whole process should i explain ? or thread design is somthing else

  • @acho8387
    @acho8387 2 ปีที่แล้ว

    Thank you, sir!

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Welcome dude.. keep learning!!

  • @rupeshkumar-kg5ej
    @rupeshkumar-kg5ej 3 ปีที่แล้ว

    Hii Rupesh.
    Your explanation is very understandable, If possible Could you please provide PPT.

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Working on it.

  • @veekysoft
    @veekysoft 3 ปีที่แล้ว +1

    Hello Rupesh .kindly upload thread debugging using gdb .
    As this topic not in list.

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Thanks man..
      Noted..

  • @dariuszmanachiewicz3088
    @dariuszmanachiewicz3088 2 ปีที่แล้ว

    std::mutex::try_lock() - is that simply speaking just like a std::mutex::lock() but with difference that it doesn't become blocking call what mutex is actually acquired by another thread and then returns false ?

  • @arielsilver7005
    @arielsilver7005 ปีที่แล้ว

    Great vid!

  • @learningcore289
    @learningcore289 3 ปีที่แล้ว

    thank you so much for uploading this!

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Our pleasure!

  • @dattatammisetti9324
    @dattatammisetti9324 2 ปีที่แล้ว

    Thankyou sir 😊

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Welcome

  • @ananyapamde4514
    @ananyapamde4514 ปีที่แล้ว

    God bless you

  • @gopapriyajena8630
    @gopapriyajena8630 3 ปีที่แล้ว

    thanks for your contribution you are the best

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      You're welcome!

    • @gopapriyajena8630
      @gopapriyajena8630 3 ปีที่แล้ว

      @@CppNuts i really want to contribute you in patreon but its not accepting the payment can you help me?
      And thanks for your contribution to society !

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      You can try joining TH-cam channel also.
      Thanks

  • @kentakeshi8716
    @kentakeshi8716 ปีที่แล้ว

    Thanks a lot

  • @mahdies9620
    @mahdies9620 3 ปีที่แล้ว

    I really like your channel

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Thank you very much.

  • @naba_nc
    @naba_nc 3 ปีที่แล้ว

    03:29:08 For producer-consumer, we should be fine without unlocking the locker right? as unique_lock already unlocks

  • @Oracle-cruX
    @Oracle-cruX 8 หลายเดือนก่อน

    at 3:11:31 was there any benefit to sending OddSum as an rvalue , as it is just an integer ?

  • @Gerald-iz7mv
    @Gerald-iz7mv 2 ปีที่แล้ว

    when to use async (with defer) vs thread? if you call future.get() its also blocking...

  • @vimalaks8342
    @vimalaks8342 3 ปีที่แล้ว

    Sir it's very useful, also can you make videos on semaphore??

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Thanks..
      Noted

  • @LongLiveIsrael-c7y
    @LongLiveIsrael-c7y 3 ปีที่แล้ว

    Thank You🙏🙏

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Always welcome

  • @oleksandrsmyrnov8295
    @oleksandrsmyrnov8295 7 หลายเดือนก่อน

    Not clear, why does the CPU "decide" to be less loaded if we do not create threads (just call one function after another) than if we create threads? I mean let's say CPU has some computation power P, there is a program without threads (just calling one function after another) "Program A" and "Program B", which does use threads. If CPU applies the whole power P to run "Program A", then it will be done with each function in it faster, than it will be done with each function if it has to "switch" between threads. As a result, Program A shall take the same time as Program B.
    Where am I wrong?:)

  • @JardaniJovonovich192
    @JardaniJovonovich192 3 ปีที่แล้ว

    How about doing videos on threading with semaphores ?
    When should we use a mutex instead of semaphore and vice versa ?

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Thanks for the good topic, noted.

  • @MukeshKumar-ty2qp
    @MukeshKumar-ty2qp 3 ปีที่แล้ว

    does promise and future uses friend function internally?

  • @puranjaypara
    @puranjaypara 3 ปีที่แล้ว

    Hi Bro, Thanks for this video. but y semaphore is not covered in this??

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Forgot..

  • @Naveenrawat-rv9df
    @Naveenrawat-rv9df 3 ปีที่แล้ว

    Hlw sir
    H i have already watched your earlier playlist on threads
    Is it worth to watch this also??

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Thanks for watching them, actually this is combination of all of them.
      With timeline if you interested you can see which you may still want to watch.

    • @Naveenrawat-rv9df
      @Naveenrawat-rv9df 3 ปีที่แล้ว

      @@CppNuts sir is there any way to get study material which u teach
      Actually to be honest watching system and mobile complete day is quite hectic so i i can gat material from where i can take hard copy and study it would be helpful
      Thanks bhai

    • @Naveenrawat-rv9df
      @Naveenrawat-rv9df 3 ปีที่แล้ว

      And also if wouldn't mind may i know ur professional r u embedded engg and application engg or else

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Application Engineer.

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      I am planning to upload things on git hub.

  • @satyajeetkumarjha1482
    @satyajeetkumarjha1482 2 ปีที่แล้ว

    Can you give a link to the repo containing all the code so that it is go through the code again?

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Chech channel's description.

  • @NehaVerma-bq6oz
    @NehaVerma-bq6oz 2 ปีที่แล้ว

    can you please give us the link for the blog for code, please

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      It’s there in channels about page.

  • @moinbagban87
    @moinbagban87 3 ปีที่แล้ว

    So, this library works on linux, what about windows?

  • @nyx1284
    @nyx1284 2 ปีที่แล้ว

    new method to generate random numbers i guess 1:08:50

  • @__hannibaal__
    @__hannibaal__ ปีที่แล้ว

    Detach() mean is independent of main() thread and will tack same time of main() thread when ended or exit.

  • @VidyasagarSeshadri
    @VidyasagarSeshadri 3 ปีที่แล้ว

    Provide link for sources

  • @mohsennokhostin
    @mohsennokhostin 2 ปีที่แล้ว

    hi were can i get the cods in this tutorial

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Check about me page of the channel.

  • @Gargentua
    @Gargentua 3 ปีที่แล้ว

    2:33 How did it execute without Chrono Library ?

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Line 29 we have some includes.

  • @randomWork111
    @randomWork111 ปีที่แล้ว

    shared mutex missing

  • @sainipankaj
    @sainipankaj 3 ปีที่แล้ว

    Is this topic Useful in CP?

  • @avtarchandra2407
    @avtarchandra2407 3 ปีที่แล้ว

    ❤️❤️❤️❤️🔥❤️🔥❤️🔥❤️🔥❤️🔥❤️❤️