我正在尝试创build自旋锁的哑版。 浏览网页时,我遇到了x86中的汇编指令,这个指令用于向处理器提示当前在该CPU上正在运行旋转locking。 英特尔手册和其他可用信息状态 The processor uses this hint to avoid the memory order violation in most situations, which greatly improves processor performance. For this reason, it is recommended that a PAUSE instruction be placed in all spin-wait loops. The documentation also mentions that "wait(some delay)" is the pseudo implementation of the instruction. 上段的最后一行是直观的。 如果我没有成功抓住锁,我必须等待一段时间,然后再次抓住锁。 但是,在自旋锁的情况下,由于内存顺序违反,我们是什么意思? […]