Re: JavaMemoryModel: Newbie Question

From: victor.luchangco@sun.com
Date: Tue Oct 28 2003 - 12:11:05 EST


Hi Bob,

> In the current memory model, what are the implications of not
> synchronizing? If you have multiple processors, can it cause a real
> error or will the value just be incosistent?

I'm not sure what you mean by "a real error". If you don't synchronize
access, you may get inconsistent results. If your program can handle
getting inconsistent results (i.e., it knows how to make sense of
them, or else to ignore them), then you should be fine. However, many
programs seeing an inconsistent result will proceed to do operations
that they should not do, which typically results in an error in your
program. Such an error may be noticeable to the program's user, but it
may also cause the program to silently return the wrong result, which is
even worse in most cases.

                                        Victor
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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