3 ms·
TL;DR: There exists a "pause" CPU instruction, which signals to the CPU that the code is in a spinlock wait loop. In Skylake this instruction sleeps longer than
by lucb1e 8y ago
TL;DR: There exists a "pause" CPU instruction, which signals to the CPU that the code is in a spinlock wait loop. In Skylake this instruction sleeps longer than before. If your code heavily uses this, then it'll wait longer for things like locks to be released.
More info on the purpose of the pause instruction: https://stackoverflow.com/questions/4725676/how-does-x86-pause-instruction-work-in-spinlock-and-can-it-be-used-in-other-sc https://stackoverflow.com/questions/4725676/how-does-x86-pau...
Info on what's a "spinlock" (I thought it was another word for busy wait, but there's a subtle difference): https://stackoverflow.com/questions/38124337/spinlock-vs-busy-wait https://stackoverflow.com/questions/38124337/spinlock-vs-bus...
- what-the-grump 8y agoGood summary at bottom of the first link. TLDR; don’t use it unless you really understand why you are pausing the cpu.
- geezerjay 8y agoGreat tldr. This should be the top post in this discussion.
- davidhyde 8y agoThere is also benefit to be had in HOW the author found the root cause of the problem. That was more interesting to me than the problem itself.
- geezerjay 8y agoI agree that's also interesting, but in a discussion with such a clickbaity title it's important to correctly identify the source of the so called problem right upfront just to avoid wild speculations and conspiracies.
- Dylan16807 8y ago> but in a discussion with such a clickbaity title it's important to correctly identify the source of the so called problem right upfront That's fair, but consider it closer to a subtitle than a tl;dr, which is supposed to be a summary that lets you skip the main body entirely. > just to avoid wild speculations and conspiracies The burden there is on people to not comment if all they know about the article is a wild guess.