4 ms·
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 ?
by bubbleRefuge 7y 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 ?
- rwem 7y agoThat’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.
- kccqzy 7y agoYes. And then it becomes an adaptive mutex.
- anewvillager 7y agoYes! That's called an optimistic spinning lock! https://linuxplumbersconf.org/event/4/contributions/286/attachments/225/398/LPC-2019-OptSpin-Locks.pdf https://linuxplumbersconf.org/event/4/contributions/286/atta...
- CodeWriter23 7y agoOr use a mutex and let the scheduler implement equitable dispatching.