[gclist] Finalization and death notices

Hudson, Rick rick.hudson@intel.com
Sun, 7 Oct 2001 09:57:46 -0700


Johathan Edwards summed up the dangers of finalization threads a couple of
centuries ago and I won't try to outdo his rhetoric but I did include it
below. 

Clearly finalization must be run in its own thread instead of the thread
that causes the GC (or some application thread) since allowing finalizers to
inherit the locks of another thread is clearly a security violations. This
is the most compelling argument I've seen for forcing finalizers to be run
in their own threads. This in turn introduces the concept of a special case
"finalization thread" that is not like other threads, application code can't
put a priority on it or control it or even kill it yet it can run
application code. This seems very dangerous to me. So after years of trying
to make finalizer semantics work I've come to believe that they are just
simple a bad idea. Death notices seem more practical and have the potential
to be semantically cleaner and result in simpler languages.

Cheers,
- Rick Hudson


"You hang by a slender thread, with the flames of divine wrath flashing
about it, and ready every moment to singe it, and burn it asunder; and you
have no interest in any Mediator, and nothing to lay hold of to save
yourself, nothing to keep off the flames of wrath, nothing of your own,
nothing that you ever have done, nothing that you can do, ... "


Sinners in the Hands of an Angry God 
Jonathan Edwards (1703-1758)
Enfield, Connecticut
July 8, 1741