Parallel C++: Spinlocks

Поделиться
HTML-код
  • Опубликовано: 4 ноя 2024
  • In this video we look at the basics of spinlocks!
    Spinlock implementation playlist: • Spinlocks
    For code samples: github.com/coff...
    For live content: / coffeebeforearch

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

  • @empireempire3545
    @empireempire3545 Год назад +4

    I love spinlocks! Nice to see they get covered on RUclips, people tend to omit/forget about them.
    But dont overuse them - they are for places where you really want to squeeze every last cycle out of the CPU. If you just let them spin for longer times, you'll notice 100% utilization on all your cores - definitely not good for laptop battery life! :D

  • @OlliS71
    @OlliS71 9 месяцев назад +2

    Spinlocks don't make sense in userspace since the thread holding the spinlock can be scheduled away, thereby keeping other threads spinning for a long time.
    Linus Torvalds says: Don't use spinlocks in userspace.

  • @quant-prep2843
    @quant-prep2843 Год назад +1

    awesome! going forward please try to include topics like multiprocessing and shared memory for C++

  • @reductor_
    @reductor_ Год назад

    With the list you should try doing splice onto a local list on the stack and release it outside the scope so you don't end up with the delete potentially dominating things, also it's worth trying adaptive locks.
    My guess is if you scale those threads up above your core count (or set not as friendly affinity) then the spin lock is going to start losing.

  • @MyChannelZs
    @MyChannelZs Год назад

    Thanks Nick for the content!
    Do you of similar commands as time and perf on Windows?

    • @CoffeeBeforeArch
      @CoffeeBeforeArch  Год назад +2

      I'm afraid I don't use windows. However, something like Intel's vtune will likely give you all the information you could want from a performance perspective.
      Cheers,
      --Nick