Parallel C++: Lock-Free and Wait-Free Algorithms

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

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

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

    Really useful video, thank you Nick!

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

    Love this series!

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

    Is wait-free example actually wait-free on arches with ll/sc atomics (like arm)?

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

      No, it would be lock-free, and not wait-free (since it's a compare and exchange loop that can fail, therefore getting rid of any guarantee of per-thread progress).
      However, there are different levels of abstraction that you could classify something as (i.e., a SW algorithm is wait-free, but the platform-specific implementation is lock-free)

    • @jays509
      @jays509 3 หลายเดือนก่อน +1

      Shouldn’t you need to do expected = sink.load() in the do while loop of the first program for it to work?

    • @spirosfoufoutos6241
      @spirosfoufoutos6241 2 หลายเดือนก่อน

      I agree. I think it's a bug. I went into the comments to see if anybody would have spotted it.

    • @pavelskripkin6871
      @pavelskripkin6871 2 หลายเดือนก่อน

      It’s not a bug, I think. 1st argument of cmpexhange is an lvalue reference, so in case of failure it will contain current sink value
      (this implicit pass-by-reference is the worst design choice ever, tbh)