Reading upon Linux Scheduler from "https://www.cs.columbia.edu/~smb/classes/s06-4118/l13.pdf" I came across a statement :

"A 64-bit value cannot be accessed atomically on a 32-bit machine"

My question is , why is it so ?

we can use locks to make it atomic, as described in the next bullet on the same article. If thats true, then what is meant by the quoted line.

有帮助吗?

解决方案

As per my comment, they probably mean that the load from memory itself isn't atomic.

A 64bit word on a 32bit machine might take two memory accesses to get the full word. During the two reads, a context switch could occur or may be overwritten by a DMA device. Therefore, you get a half correct value.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top