Re: JavaMemoryModel: Idiom for safe, unsynchronized reads

From: Bill Pugh (pugh@cs.umd.edu)
Date: Mon Jun 28 1999 - 15:53:28 EDT


>It's interesting that your example is one that would violate the JLS, at least
>if done consistently, since the cached memory values might not be
>valid for the
>type of the variable. Still, most of the problems I can see with this type of
>system would be corrected by resetting the cache on every processor any time a
>GC operation is done, and this would be required for any compliant
>JVM on such a
>system in any case.

Doing this would make sure that you never saw a field containing
garbage. By allocating objects out of pre-zeroed memory, you would
see either the default value (which corresponds to zeroed memory), or
something written by the constructor.

However, this doesn't help us with the object header. Seeing zeroed
memory for the header of an object would be very bad.

        Bill Pugh

-------------------------------
This is the JavaMemoryModel mailing list, managed by Majordomo 1.94.4.

To send a message to the list, email JavaMemoryModel@cs.umd.edu
To send a request to the list, email majordomo@cs.umd.edu and put
your request in the body of the message (use the request "help" for help).
For more information, visit http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:13 EDT