[Gc] External thread suspension

Keith Seitz keiths at redhat.com
Mon Dec 5 16:08:48 PST 2005


Hi all,

As some readers may be aware, I've been looking at adding JDWP support 
to gcj, and a long time ago, I posted a message on the gcj list 
soliciting advice about how to handle thread suspension, especially in 
light of the gc. [And now that I'm back from my hiatus, I get to solicit 
people for more advice! :-)]

Mr. Boehm replied quite authoritatively that the best solution would be 
for the JDWP code to "share" a common thread-suspension facility with 
the gc.

I don't know exactly what Mr. Boehm had in mind, but I've done something 
which meets my goals (which may not coincide with the goals for the gc):

* Least invasive (i.e., not a rewrite)
* Low risk (i.e., code path should be as close as possible to today's 
code for anything not using the new functionality)
* Add methods to suspend a thread from any other thread, suspend the 
calling thread, and resume any of those threads
* Allow the GC to safely run when a thread has been suspended by some 
external entity
* An externally suspended thread cannot be resumed while the GC is 
running (by that I mean, it is impossible for a thread to request a 
restart of a thread while the gc is running). Perhaps a tad restrictive?
* KISS. This means that routines can only be used for 
suspension/resuming. Any required higher-level abstraction is left to 
those who attempt to use these new functions. [For example, JDWP uses 
suspend counts -- which should be implemented in gcj, not in the gc IMO.]
* pthread only right now

Having said that, I think that I have something which I believe 
satisfies all of these assumptions/goals, and would like to gather 
comments from developers about problems with the code, erroneous 
assumptions/goals, etc.

I've attached two files, one is a massage of pthread_stop_world.c 
(complete with ten thousand random comments concerning threading and 
other issues) in its entirety for readers to use with their favorite 
diffing program. The other is a diff of pthread_stop_world.c and 
pthread_support.h for those who prefer that. These are based on the 
version of the gc in the gcc repository. It doesn't look like it would 
be much of a problem to integrate this with the 6.6 release.

Needless to say, I'm sure there are problems with the code (not to 
mention the goals). Please be gentle with me. ;-)

Keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread_stop_world.c
Type: text/x-csrc
Size: 18203 bytes
Desc: not available
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20051205/e51b2917/pthread_stop_world-0001.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread_stop_world.diff
Type: text/x-patch
Size: 10385 bytes
Desc: not available
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20051205/e51b2917/pthread_stop_world-0001.bin


More information about the Gc mailing list