3 ms·
> What these benchmarks have in common is that they measure code in which there is nothing else to do except fight over the lock. In that environment the only t
by jiveturkey 7y ago
> What these benchmarks have in common is that they measure code in which there is nothing else to do except fight over the lock. In that environment the only thing that makes sense is to use a spinlock. Because if you go to sleep, all that will happen is that some other thread will wake up that will fight over the same lock.
That said, his conclusion is in fact just as you stated, if you read in between the lines. (This paper is really about the scheduler, so it's not exactly that conclusion.)
- trasz 7y agoAnd that’s precisely what most operating systems other than Linux do: use adaptive mutexes as the default mechanism, not spinlocks.
- gpderetta 7y agoPthread_mutex on linux is also an adaptive mutex, although the spinning count might not be optimal.
- banachtarski 7y agoYou don't even need to read in between the lines. He literally states that in his conclusion...