英特尔Cpu上原子cmpxchg指令的平均延迟 [英] Average latency of atomics cmpxchg instructions on Intel Cpus

查看:131
本文介绍了英特尔Cpu上原子cmpxchg指令的平均延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在寻找有关各种intel处理器的锁cmpxchg指令的平均延迟的参考.我无法在该主题上找到任何好的参考文献,任何参考文献都会有很大帮助.


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 and any reference would greatly help.

谢谢.

推荐答案

由于存在太多差异,因此对此的引用很少(如果有的话).它基本上取决于一切,包括总线速度,内存速度,处理器速度,处理器数量,周围指令,内存围栏以及月亮与珠穆朗玛峰之间的夹角...

There are few, if any, good references on this because there is so much variation. It depends on basically everything including bus speed, memory speed, processor speed, processor count, surrounding instructions, memory fencing and quite possibly the angle between the moon and Mt Everest...

如果您有一个非常特定的应用程序,例如已知(固定)硬件,操作环境,实时操作系统和独占控制,那么可能会很重要.在这种情况下,基准测试.如果您对软件的运行位置没有这种级别的控制,那么任何度量实际上都是毫无意义的.

If you have a very specific application, as in, known (fixed) hardware, operating environment, a real-time operating system and exclusive control, then maybe it will matter. In this case, benchmark. If you don't have this level of control over where your software is running, any measurements are effectively meaningless.

这些答案中所述 ,锁是使用CAS来实现的,因此,如果您可以使用CAS而不是锁(它将需要至少两次操作),那么它会更快(值得注意的是?仅可能).

As discussed in these answers, locks are implemented using CAS, so if you can get away with CAS instead of a lock (which will need at least two operations) it will be faster (noticeably? only maybe).

您将找到的最佳参考文献是英特尔软件开发人员手册,由于变化很大,因此不会提供实际数字.但是,它们将描述如何获得最佳性能.可能是处理器数据表(例如,i7 Extreme Edition的此处) 技术文档")将为您提供实际编号(或至少一个范围).

The best references you will find are the Intel Software Developer's Manuals, though since there is so much variation they won't give you an actual number. They will, however, describe how to get the best performance possible. Possibly a processor datasheet (such as those here for the i7 Extreme Edition, under "Technical Documents") will give you actual numbers (or at least a range).

这篇关于英特尔Cpu上原子cmpxchg指令的平均延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆