CppCon 2017: Fedor Pikus “Read, Copy, Update, then what? RCU for non-kernel programmers”

Поділитися
Вставка
  • Опубліковано 7 жов 2024

КОМЕНТАРІ • 17

  • @almightysquirrel4679
    @almightysquirrel4679 7 років тому +11

    Great video. Everything very intuitively described, I liked video about atomics by Fedor Pikus also. Great job! Waiting for your videos next year, thanks.

  • @jimlin897
    @jimlin897 6 років тому +4

    Wonderful talk! Thanks!

  • @andmefikri7555
    @andmefikri7555 2 роки тому +2

    Thank you! This talk was amazing :D

    • @CppCon
      @CppCon  2 роки тому +1

      Glad it was helpful!

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

    17:18 "you do the modulo to get the index of the block and then you do the remainder to get the position of the data in the block", obviously he meant to say "division" (ie quotient), not modulo. (*(p[i/N]))[i%N] or something, i do not remember precedence of dereference

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

    Thank you really great video.

  • @on-hv9co
    @on-hv9co Рік тому +2

    Please correct me, because I want to be wrong about this: Isn't there a race condition between rcu_read_lock and synchronize_rcu? lets say a reader grabs generation N, and the current ref count is 0; there is some time between the execution of the generation load and the refcount increment. In this time between generation load and refcount increment, synchronize_rcu is called and gets current generation N and increments it. Before the reader thread has a change to get its increment in, the writer sees that refcount is 0 and proceeds to release the memory. the reader finally comes back to life and attempts to use the handle it was guaranteed to have life time support for but its resource is no longer alive. However improbable, can this race condition occur?

    • @guillaumecourrier7489
      @guillaumecourrier7489 Рік тому +1

      I don't think this is the case. If you look at the synchronize_rcu implementation that was shown, it will store the current generation value N in last_gen and will do the cleanup of each generation from last_gc_gen to last_gen excluded. So if a reader grabs generation N the writter will do the cleanup up to N - 1. I think synchronize_rcu will not cleanup the memory of the current and previous generations in the code that was shown.

    • @Ricky-kx6pf
      @Ricky-kx6pf Рік тому +2

      @@guillaumecourrier7489 Please correct me, what if synchronize_rcu is called twice between the execution of the generation load and the refcount increment?

    • @jjaychen
      @jjaychen 11 місяців тому

      @@Ricky-kx6pfCurious about this, too. Did you figure it out?

    • @sunjc826
      @sunjc826 11 місяців тому +1

      @@jjaychen I was thinking you could do a double check, before getting the handle and after getting the handle, and return the handle only when the generation count has not changed. That way, you can guarantee the increment was registered.
      Somewhat similar to what the SeqLock does?

    • @blah0123455
      @blah0123455 7 місяців тому

      I had the same question. I think a loop that does a double check makes sense. It would guarantee correctness, and If the generation isn't updated often, then most of the time the generation numbers would match and so the double check loop wouldn't be too costly either.

  • @aniketbisht2823
    @aniketbisht2823 8 місяців тому

    57:13 "Readers can crash", I hope it's not because of undefined behavior.

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

    I know that will works, because i write language based, asked data scientist to check our backend,