[concurrency-interest] Synchronization question

Tim Peierls tim at peierls.net
Wed Jun 28 09:49:50 EDT 2006


On 6/28/06, Holger Hoffstätte <holger at wizards.de> wrote:
>
> Brian quoted: "Storing a reference to [the published object] into a field
> that is properly guarded by a lock." but then added "all accesses (read
> and write)". The former would allow for an unspecified window where the
> change is not-quite-visible-yet, but eventually will (MEM_AUTO_COMMIT :).
> The latter would mean that *all* references to *all* fields of a compound
> object that is shared between threads *must* be accessed from inside a
> synchronized method or at least in a synchronized block to ensure
> visibility. We can only guess how many lines of Java code don't do that;
> that's why I was wondering about the possible fallout.


The fallout is potentially huge.

Here is another JCiP quote: "If multiple threads access the same mutable
state variable without appropriate synchronization, <em>your program is
broken</em>. (p.16)"  (The term "access" refers to both reads and writes.)

There are probably a lot of broken programs out there.

--tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060628/a6e47375/attachment.html 


More information about the Concurrency-interest mailing list