0

我曾经读过本机类型是原子的,只要它们不比内存总线宽并且对齐。我可能对此非常错误,但是即使对于 32 位 CPU( http://en.wikipedia.org/wiki/Front-side_bus),内存总线通常不是 64 位吗?在哪种情况下,上面的语句意味着读取或写入或对齐的 64 位本机类型将是原子的,对吗?我查看了英特尔的文档,它说 x86 只能保证 32 位及以下的原子 - 但我想确保我正确理解内存总线宽度部分。

谢谢!

4

1 回答 1

2

The width of the memory bus has nothing whatsoever to do with the atomicity of memory accesses. You could have a one-bit memory bus and still have atomic 64-bit memory accesses by holding the bus through 64 reads or writes. You could have a 64-bit bus but not atomic 64-bit memory accesses if the path between the CPU and the cache was 32-bits and the cache could not be locked.

于 2013-08-22T18:34:48.287 回答