[concurrency-interest] Assignment of references atomic?

Joe Bowbeer joe.bowbeer at gmail.com
Wed Oct 12 14:54:38 EDT 2005


Tim Peierls <tim at peierls.net> wrote:
>
> The situation with doubles is even worse: not only will threads not necessarily see
> the most recent value, but the value seen might not be a value that was ever written
> by any thread, a so-called "out of thin air" value.
>

Minor point: I think "out of thin air" is too strong a term to use for
the corruption that is permitted for (64-bit) longs and doubles.

http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.7

"For the purposes of the Java programming language memory model, a
single write to a non-volatile long or double value is treated as two
separate writes: one to each 32-bit half. This can result in a
situation where a thread sees the first 32 bits of a 64 bit value from
one write, and the second 32 bits from another write."



More information about the Concurrency-interest mailing list