RE: JavaMemoryModel: Another Java threading issue (finalization)

From: Alexander Terekhov (TEREKHOV@de.ibm.com)
Date: Tue Apr 01 2003 - 15:40:29 EST


David Holmes wrote:
[...]
> Hmmm. I suppose if we just said "an object is always reachable while
> an invocation upon it is active" then the compiler folk would get
> upset?

OTOH, I think that any concessions that would allow to evaporate
objects "faster" than good old reference counting would surely
upset everyone and his dog... except compiler folk, probably. ;-)

regards,
alexander.

Sent by: owner-javamemorymodel@cs.umd.edu
To: "Jerry Schwarz" <jerry.schwarz@oracle.com>, "Boehm, Hans"
<hans_boehm@hp.com>
cc: <javamemorymodel@cs.umd.edu>
Subject: RE: JavaMemoryModel: Another Java threading issue
(finalization)

Jerry Schwarz wrote:
> The next sentence is that "optimizing transformations of a
> program can be designed that reduce the number of objects that are
> reachable to be less than those which would naively be considered
> reachable."

Sure. As discussed the end result is that there is always a race
between an unsynchronised finalizer (and similarly for "weak"
references) and normal use of the object. This means the finalizer can
execute before code that notionally/naively is expected to complete
first.

Should this race be removed?

Well I was just considering a use of a finalizer that involved freeing
a native memory block. It would be really bad if the finalizer could
run before the method that will use the native memory. ;-) It would
also be really ugly to have to use synchronization just in case the VM
uses a separate finalizer thread.

Hmmm. I suppose if we just said "an object is always reachable while
an invocation upon it is active" then the compiler folk would get
upset?

David Holmes

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

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



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