Quick explanation: the Bounded-Buffer problem

Поділитися
Вставка
  • Опубліковано 16 гру 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.
      ua-cam.com/video/boPEO2auJj4/v-deo.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 6 місяців тому

      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.

  • @yasmikash
    @yasmikash 5 років тому +3

    the best EXPLANATION EVER!

  • @bsce100
    @bsce100 5 років тому +3

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

  • @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.

  • @stevenmcgown6552
    @stevenmcgown6552 3 роки тому

    Underrated channel. Thank you, I subscribed.

  • @nadiakacem24
    @nadiakacem24 3 роки тому +1

    thank you so much

  • @Tracing0029
    @Tracing0029 6 місяців тому

    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.

  • @indiamoneypurse5738
    @indiamoneypurse5738 6 років тому +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!!!

  • @bubblesgrappling736
    @bubblesgrappling736 4 роки тому

    the semiphors video, where can I find it?

  • @haidershah5679
    @haidershah5679 6 років тому +2

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

  • @aycayigit9582
    @aycayigit9582 6 років тому

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

  • @lata7914
    @lata7914 5 років тому

    Excellent explaination

  • @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.

  • @乔五
    @乔五 3 роки тому

    Thank you very much! Appreciate!

  • @jaimelannister9933
    @jaimelannister9933 4 роки тому

    I really liked it. Good!

  • @Pages_Perfected
    @Pages_Perfected 2 роки тому

    You Are Good!

  • @jizanthapus176
    @jizanthapus176 3 роки тому

    Many thanks.

  • @sheriffola
    @sheriffola 6 років тому

    Great 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/

  • @khaled7370
    @khaled7370 5 років тому

    thank you a lot prof.

  • @PedritoLima73
    @PedritoLima73 6 років тому

    good explanation

  • @umarsadiqibrahim
    @umarsadiqibrahim 5 років тому

    Good Video

  • @OlliS71
    @OlliS71 10 місяців тому

    Use a deque and there's no full condition.

  • @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.