cpu reorder

来源:互联网 发布:厦门大学软件学院地址 编辑:程序博客网 时间:2024/06/08 05:38

Reordering Summary

The Xbox 360 CPU reorders memory operations much more aggressively than do x86 and x64 CPUs, as shown in the following table. For more details, consult the processor documentation.

Reordering Activityx86 and x64Xbox 360Reads moving ahead of readsNoYesWrites moving ahead of writesNoYesWrites moving ahead of readsNoYesReads moving ahead of writesYesYes

Read-Acquire and Write-Release Barriers

The main constructs used to prevent reordering of reads and writes are called read-acquire and write-release barriers. A read-acquire is a read of a flag or other variable to gain ownership of a resource, coupled with a barrier against reordering. Similarly, a write-release is a write of a flag or other variable to give away ownership of a resource, coupled with a barrier against reordering.

The formal definitions, courtesy of Herb Sutter, are:

  • A read-acquire executes before all reads and writes by the same thread that follow it in program order.
  • A write-release executes after all reads and writes by the same thread that precede it in program order.

原创粉丝点击