[concurrency-interest] Assignment of references atomic?

David Holmes dholmes at dltech.com.au
Wed Oct 12 19:00:14 EDT 2005

Mike Skells wrote:
> Without doing something it is certainly unsafe unless the object is
> volatile, as there is nothing to force the object to be written or read
> from the global address space, so the object references could be assigning
> and rading data from the thread cache only

This is not directed at Mike personally.

I'd like to try and dissuade people from explaining JMM issues this way. The
old JMM did indeed use a conceptual thread-cache, or working memory, and was
defined in terms of when things had to move between working memory and main

The new JMM says nothing about caches because that is only one potential
part of the problem - the bigger part being the compiler and the reorderings
that can occur in both hardware and software. The problem with talking about
caches is that people turn round and say "well the cache on my hardware
doesn't work like that, so I don't have to worry about this". And indeed on
some architectures you are essentially guaranteed that all values in cache
make their way to main memory. It is easier to make an argument that a
variable might be placed in a register by the compiler. :)

David Holmes

More information about the Concurrency-interest mailing list