Average latency of atomics cmpxchg instructions on Intel Cpus

前端 未结 5 492
独厮守ぢ
独厮守ぢ 2020-12-31 16:09


I am looking for some reference on average latencies for lock cmpxchg instruction for various intel processors. I am not able to locate any good reference on the topic

5条回答
  •  既然无缘
    2020-12-31 16:15

    The best x86 instruction latency reference is probably that contained in Agner's optimization manuals, based on actual empirical measurements on various Intel/AMD/VIA chips and frequently updated for the latest CPUs on the market.

    Unfortunately, I don't see the CMPXCHG instruction listed in the instruction latency tables, but page 4 does state:

    Instructions with a LOCK prefix have a long latency that depends on cache organization and possibly RAM speed. If there are multiple processors or cores or direct memory access (DMA) devices then all locked instructions will lock a cache line for exclusive access, which may involve RAM access. A LOCK prefix typically costs more than a hundred clock cycles, even on single-processor systems. This also applies to the XCHG instruction with a memory operand.

提交回复
热议问题