Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top