RE: JavaMemoryModel: Memory model and finalize methods

From: David Detlefs - Sun Microsystems Labs BOS (david.detlefs@sun.com)
Date: Tue Dec 14 1999 - 11:47:09 EST


Rick Hudson says:

> The appropriate rules have to be the same as the rules for
> any other concurrent access to a shared variable. The thread
> that does the finalization should expect to obey the same
> rules as any other thread accessing potentially shared
> variables. If reordering is allowed by the memory model
> semantics when there is no finalization then it should be
> be allowed when there is finalization. This is a weaker
> statement than what Bill suggests.

I think the problem that Bill is implying is this. Under the rough
model that seems to be evolving, a read by Thread B would be required
to observe a write by Thread A only if Thread A released a lock after
its write that thread B then acquired before it's read.

This kind of model does not cover communication between regular
mutator threads and the finalizer thread(s). If one has a
non-synchronized finalize method (and almost all are, since,
reasonably enough, one expects that only the finalizer thread has
access to an object being finalized), then there may be no lock that the
finalizer thread acquires that the mutator thread that did the writes
to the object ever held. Thus Bill's motivation for adding a special
rule for finalizers.

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



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