Ring Buffer

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

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

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

    great demonstration of a simple implementation of circular buffer. those structure are really useful with Arduino and other microcontroller. I usually reserve a node as an indicator for "overflow/datalost" that might be important to log (or turn on a warning light). I just recreate the node after sending/emptying the buffer and start at 0 instead of -1.

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

      Great idea regarding the overflow indicator 👍🏻

  • @MitchelTighe-sj5fm
    @MitchelTighe-sj5fm ปีที่แล้ว

    Hey Josh, I'm a young Unix admin with an extremely weak background in computer science so most of your videos go over my head, but I really appreciate the depth you provide in your videos. Just wanted to say thanks your work is appreciated.

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

      Keep at it, learning comp sci stuff with a Unix admin background will set you up well!

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

    Thank You a lot! You did great job explaining! Its a bit overkill for me still, but you explain it very well! I probably will watch video 10 times until I get everything :)

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

    Really good video! Like it! Expecting more good quality ones.👍

  • @aamonaze
    @aamonaze 9 หลายเดือนก่อน

    great explained

  • @sternparadis227
    @sternparadis227 7 หลายเดือนก่อน +2

    There are several flaws in this implementation of the algorithm which are 'solved' by you using nil values.
    The first problem is in the Insert method. The first value inserted increases _lastInsert_ index by 1. At this point _nextRead_ is 0 and thus equal to _lastInsert_ which is now also 0. This executes the code that increases the _nextRead_ index by 1.
    The second problem lies in the Emit method. When in the loop the last character is read, the loop breaks but the _nextRead_ index is not increased. So the _nextRead_ is still pointing to the previous position.
    As said both problems are obfuscated by the fact you use nil values.

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

    Your videos are great! Thank you!

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

      Thanks for watching!

  • @ChimiChanga1337
    @ChimiChanga1337 5 หลายเดือนก่อน +1

    Hey John, the blog seems to be down.

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

    Great tutorial, I got here from the blog post.Please can I know the software you are using to draw over the code editor. I have an xpen device but endup switching on different screens. Also some implementation block the insert/read when its full/empty. My guess is that data loss is ok for your use case.

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

      Exactly! My goal/design trade-off here is to intentionally allow for overflow, prioritizing newest data.
      The drawing you're seeing is a screen annotating tool, Presentify.

  • @Lado93
    @Lado93 3 หลายเดือนก่อน

    insert method is wrong i think..the if lastInsert == nextRead will be true after first insert. If the nextRead is 0 on init then after insert first insert lastInsert is 0 then the statement is true and you will move the nextRead to 1 and so one and so one. Solution would be to check if the last value of ring buffer N-1 is null or not if is null that mean you yet didn't fill the whole ring buffer else if there is value already then it make sense for the nextRead to move

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

    what is your zsh/iterm theme?

  • @gimmemoreborisbrejcha9794
    @gimmemoreborisbrejcha9794 3 หลายเดือนก่อน

    Bro my eyes... make this in a darker background fgs