At 5:56 PM +0100 1/23/04, Leopold Toetsch wrote:
Dan Sugalski <[EMAIL PROTECTED]> wrote:
At 12:04 AM -0500 1/20/04, Gordon Henriksen wrote:
C was not marked reachable (although it was) and was thus
erroneously collected, leaving a dangling pointer. This problem
applies equally to copying and mark-sweep collectors.

Ah, OK, I see.

That is well knowm in the literature as "Tri-Color Invariant": Black are the already marked (live) PMCs, grey the PMCs on the next_for_GC list, white the not yet reached PMCs. The strong tri-color invariants states that no black object may point to a white object, the weak invariant states, that at least one path from the black to a white object must contain a grey one.

This can be handled by either stop the world GCs or by intercepting each
read or write access that would change the color of an object and update
the color accordingly. This is e.g. used for incremental GC. As soon as
we have a thread in the background that runs GC, we have to cope with
these issues.

Yeah, point. And since we want to be able to have an incremental DOD at some point we need to get support for it in now.


> ... or have some way to force a
low-overhead rendezvous.

 Okay, we're going to mandate that we have read/write locks, each
 interpreter pool has one, and mutating vtable entries must get a read
 lock on the pool read/write lock. Pricey (ick) but isolated to
 mutators. The DOD gets a write lock on it, which'll block all
 read/write access so no mutators can be in process while the pool DOD
 runs.

Stopping all interpreters seems to be cheaper. The rwlock will sooner or later stop all interpreters anyway (on first PMC access), so we can omit the price for the rwlock and just hold the world(s).

The rwlock only stops all the interpreters when the DOD runs. Anything that mutates a PMC gets a *read* lock so that they don't interfere with each other, and only pause if the DOD is running. The DOD getting a *write* lock will block any read lock attempts, so when the DOD is running no mutation can take place. Since mutation doesn't require any global exclusion it doesn't need a write lock -- the read lock is sufficient.


An alternative would be real background incremental GC, *when* running
multiple threads. I estimate the overhead to be in regions of a rwlock
(with no contention of course).

If we have the facilities to do incremental DOD runs then this is definitely a possibility except for finalizers. Finalizers make things interesting, though if the background thread doing the DOD is a member of the interpreter pool then it'd work out OK.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to