I love spinlocks! Nice to see they get covered on TH-cam, 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
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.
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.
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
I love spinlocks! Nice to see they get covered on TH-cam, 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
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.
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.
Thanks Nick for the content!
Do you of similar commands as time and perf on Windows?
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
awesome! going forward please try to include topics like multiprocessing and shared memory for C++