Re: [Sablevm-developer] question about _svmf_stop_the_world()
Brought to you by:
egagnon
From: Prof. E. M. G. <eti...@uq...> - 2003-03-31 16:35:05
|
Archie Cobbs wrote: > Presumably you could have simplified things by just waiting for all > threads to stop (instead of just waiting for non-JNI threads) before > GC'ing, but then you might have to wait an arbitrarily long time, > because a JNI thread could be doing something slow, sleeping, etc. 1) Non-JNI threads have at least one GC check point per loop iteration (this is a simplification of the reality which includes method entry, etc.) 2) Nothing prevents a JNI thread to go into a infinite loop, or not to call-back the VM, or to sleep indefinitely. So, it is reasonable to assume a non-JNI thread will soon reach a GC point, and it would be an error to wait for JNI threads to return or call back the VM before proceeding with GC. In fact, if you read the JNI spec carefully, you'll notice how direct access to a reference is never given to native code. You may rightfully deduce that this was made specifically to allow concurrent disruptive GC (e.g. moving collectors like copying GC). If you enjoy learning about SableVM's stop-the-world protocol, go back to reading the monitor enter/exit related code which is closely related... Etienne -- Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |