On Intel processors, compare-and-swap is implemented by the CMPXCHG family of instructions.
在Intel处理器中,比较并交换通过指令的cmpxchg系列实现。
You need to understand CMPXCHG and related instructions like CMPXCHG8B well, because they form the crux of lock-free solutions.
需要了解 CMPXCHG 和 CMPXCHG8B 等相关指令是因为它们构成了无锁解决方案的核心。
You might find them by inspecting your binary for the typical spin-lock pattern at your system, e. g. , loop: CMPXCHG <adr>, JRZ loop.
你可能会发现他们通过检查你的系统二进制为典型的旋转锁模式,例如,loop: CMPXCHG <adr>, JRZ loop 。
应用推荐