...
首页> 外文期刊>Dr. Dobb's Journal >Memory Consistency & .NET
【24h】

Memory Consistency & .NET

机译:内存一致性和.NET

获取原文
获取原文并翻译 | 示例
   

获取外文期刊封面封底 >>

       

摘要

Release consistency enables portability because commercial processors are as strict or stricter about ordering memory operations. Intel's Itanium supports acquire/release in its full glory. Alpha, PowerPC, Spare, and IA-32 provide "fence" instructions that prevent migration of reads and/or writes over the fence. Often, multiple flavors of fences are offered for programmers who really want to nitpick over what orderings must be enforced. Unless you are working in assembly language, you need a compiler that plays along. For .NET, the acquire/release semantics of volatile locations is standard. Otherwise, you are stuck using processor-specific assembly code. Even on Itanium, where C/C++ compilers imbue volatile loads/stores with acquire/release, you are still stuck because the optimizers might move nonvolatile loads/stores across volatile loads/stores. In most cases, the best way is simply to use higher level synchronization primitives such as locks, which typically invoke the processor-specific instructions where necessary. As long as your code makes no assumptions stronger than the diode rules for locking, it should run correctly on most platforms.
机译:发布一致性使可移植性得以实现,因为商用处理器在订购内存操作方面越来越严格。英特尔的Itanium全面支持获取/发布。 Alpha,PowerPC,Spare和IA-32提供“围栏”指令,以防止在栅栏上迁移读取和/或写入。通常,对于确实想挑剔必须执行哪些命令的程序员,会提供多种形式的防护。除非您使用汇编语言工作,否则您需要一个可配合使用的编译器。对于.NET,易失性位置的获取/发布语义是标准的。否则,您将无法使用处理器专用的汇编代码。即使在Itanium上,C / C ++编译器通过获取/发布对易失性负载/存储进行赋值,您仍然会卡住,因为优化程序可能会在易失性负载/存储之间移动非易失性负载/存储。在大多数情况下,最好的方法是简单地使用更高级别的同步原语,例如锁,这些原语通常在必要时调用特定于处理器的指令。只要您的代码没有比二极管锁定规则更强的假设,它就可以在大多数平台上正常运行。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号