Y
Hacker News
new
|
ask
|
show
|
jobs
by
bubbleRefuge
2363 days ago
couldn't you eliminate the bad spinlock behavior by coding them to be go into an efficient wait if to much spinning is going on ?
4 comments
rwem
2363 days ago
That’s what virtually all battle-hardened lock libraries do: spin for a bit (but not too tightly, using a pause in the loop) then fall back to waiter lists and futex.
link
anewvillager
2363 days ago
Yes! That's called an optimistic spinning lock!
https://linuxplumbersconf.org/event/4/contributions/286/atta...
link
CodeWriter23
2363 days ago
Or use a mutex and let the scheduler implement equitable dispatching.
link
kccqzy
2363 days ago
Yes. And then it becomes an adaptive mutex.
link