Re: JavaMemoryModel: volatile arrays

From: Doug Lea (
Date: Wed Dec 01 1999 - 12:25:04 EST

> "final volatile" is disallowed in java,

The "final" would serve only as documentation/enforcement of the
design constraint here, and need not be present.

> and by the rules of volatile there
> doesn't seem to be any need to synchronize the reads on your example.

No. Unless I misunderstand them, the current rules do NOT quite say
this (instead, volatile is specified to affect reads of only the
reference itself, not its elements). My point is that the rules could
be changed to say this without impacting anyone, because machines
actually give you the intended effect.

The intended effect does arguably hold in Bill's proposal,
but he has not yet posted anything about interactions of
synch and volatile.

> so i assume you are proposing some sort of language change,

Not a language change (although allowing both final and volatile
would be nice here.) Just a model change/clarification.

JavaMemoryModel mailing list -

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