Quick explanation: the Bounded-Buffer problem

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

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

  • @christianimmanuelk1751
    @christianimmanuelk1751 4 года назад +4

    what is the example in real life?

    • @binarywisdom4501
      @binarywisdom4501  4 года назад +11

      It is used often when data stream must be arranged between threads or processes, maybe even between a process and a hardware.
      For example, the bounded bounded buffer data structure is very popular in audio programming. In audio programming, it is usually called "ring buffer". The implementation of such ring buffers is usually different from textbook solutions because at least one party is a real-time thread and should not block (can't wait). Audio programmers usually use "lock-free" solutions based on atomics.
      For the discussion of specific use cases, check the following cool presentation from CPPCon. The speaker talks about bounded buffer usage.
      ruclips.net/video/boPEO2auJj4/видео.htmlm53s
      Also, here is a couple of links to the Audacity code. Files RingBuffer.h and RingBuffer.cpp contain the real-life implementation of the bounded buffer.
      github.com/audacity/audacity/blob/master/src/RingBuffer.h
      github.com/audacity/audacity/blob/master/src/RingBuffer.cpp

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

      Basically any limited resources which is shared between processes (by processes I mean an abstract process, it could be thread, a file descriptor etc.).

  • @dp-mason
    @dp-mason 5 лет назад +22

    It's people like you that make it possible for me to pass my exams without a tutor. Thank you so much.

  • @johnl2132
    @johnl2132 4 года назад +3

    This video was so well made and clearly understandable that I just purchased a subscription. (The price also was right and so it was a no-brainer.) Thank you!

    • @binarywisdom4501
      @binarywisdom4501  4 года назад

      Thank you for your kind words and hope it will be helpful.

  • @BlackStormGamingRo
    @BlackStormGamingRo 3 года назад

    Great video. I need to study for an exam and my teacher's course is unclear and full of mistakes. Your video was most useful.

  • @bsce100
    @bsce100 5 лет назад +3

    This was the best explanation that I've come across! Thank you!!

  • @yasmikash
    @yasmikash 5 лет назад +3

    the best EXPLANATION EVER!

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

    Nice and clear explanation! I am wondering, is it really needed ot have 2 semaphores? You could just use one non-binary semaphore and increment and decrement it accordingly based on which process does which operation.

  • @stevenmcgown6552
    @stevenmcgown6552 3 года назад

    Underrated channel. Thank you, I subscribed.

  • @nadiakacem24
    @nadiakacem24 3 года назад +1

    thank you so much

  • @bubblesgrappling736
    @bubblesgrappling736 4 года назад

    the semiphors video, where can I find it?

  • @indiamoneypurse5738
    @indiamoneypurse5738 5 лет назад +2

    Good Explanation, Hope to see some more videos on operating system topic. :)

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

    you are a legend sir

  • @ashensavinda99
    @ashensavinda99 3 года назад

    What a great explanation!!!

  • @andreialopes3166
    @andreialopes3166 4 года назад

    What's the difference between using only one producer and several producers?

    • @binarywisdom4501
      @binarywisdom4501  4 года назад

      More complex synchronization is needed. You got to handle not only producer-consumer synchronization but also make sure that multiple producers or multiple consumers don't conflict between themselves.

  • @Teslacoil33
    @Teslacoil33 5 лет назад

    Can somebody explain why using mutual exclusion will not work in the Producers & Consumers problem?

    • @binarywisdom4501
      @binarywisdom4501  5 лет назад

      You can make it work, though it wouldn't be so elegant. Semaphores are the solution from one of the most popular college textbooks on Operating Systems. If you want to use something like mutexes, you can but don't try to lock the whole buffer with it. It would be very inefficient.

  • @aycayigit9582
    @aycayigit9582 5 лет назад

    May you explain other problems of synchronization, it would be really great!

  • @lata7914
    @lata7914 5 лет назад

    Excellent explaination

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

    You Are Good!

  • @jizanthapus176
    @jizanthapus176 3 года назад

    Many thanks.

  • @haidershah5679
    @haidershah5679 6 лет назад +2

    Thank u.... Great video ...nice explaination

  • @乔五
    @乔五 3 года назад

    Thank you very much! Appreciate!

  • @jaimelannister9933
    @jaimelannister9933 4 года назад

    I really liked it. Good!

  • @austinleestudent94
    @austinleestudent94 3 года назад

    You did not include the necessary mutex to ensure mutual exclusion between the consumer and the producer. This is not a complete explanation.

    • @binarywisdom4501
      @binarywisdom4501  3 года назад +1

      All the necessary synchronization is in place here. You don't need any special mutexes for this version of the problem (single producer and single consumer). Try to come up with a scenario that causes a mistake and you'll see how it works like that.

  • @khaled7370
    @khaled7370 4 года назад

    thank you a lot prof.

  • @sheriffola
    @sheriffola 6 лет назад

    Great explanation!

  • @umarsadiqibrahim
    @umarsadiqibrahim 4 года назад

    Good Video

  • @PedritoLima73
    @PedritoLima73 6 лет назад

    good explanation

  • @emmayin6822
    @emmayin6822 6 лет назад +2

    great videos! can you please make a video about semaphore? thanks!

    • @binarywisdom4501
      @binarywisdom4501  6 лет назад +1

      Thank you. The rest is a part of the online "course" that can be found at
      binary-wisdom.teachable.com/p/quick-explanations-for-the-operating-systems-course/

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

    Use a deque and there's no full condition.