Why Skylake CPUs Are Sometimes 50% Slower
The title is misleading — no code is broken, though it is true that .NET programs that exhibit lock contention will be slower.<p>The root of the problem is that .NET implemented a rather baroque spin loop with several assumptions about the CPU and OS architecture. Unlike any other spin loop I have seen or written, they execute multiple pause instructions per loop. Arguably this was a poor choice.<p>It would be interesting to see the history of this design. It was probably done years ago when .NET was closed source.