[Gc] gc and quickthreads

Boehm, Hans hans.boehm at hp.com
Tue Jun 15 16:25:06 PDT 2004

At a minimum you need to implement mechanisms to stop other threads
(GC_stop_world(), GC_start_world()) and to push the contents of all
thread stacks (GC_push_all_stacks()).  The latter may require intercepting
thread creation calls, so that you can keep track of enough

If your threads package doesn't support a standard pthreads interface,
you also need to teach the collector how to acquire locks, etc.
(See gc_locks.h, which is about to get redone.)

You can look at pthread_support.c and pthread_stop_world.c to get some
idea what's involved.  But remember that that also supports several
facilities that may not be needed, e.g. thread-local allocation.  And
you might be able to reuse pthread_support.c. Aix_irix_threads.c
is a somewhat simpler implementation of the same
interface, which is likely to get merged into the generic pthreads code.

I expect that for a simple threads package which exports routines to
find all threads in the system together with their stacks, and without
thread-local allocation or parallel GC, and with reasonably performant
built-in locks, this can all be done in well under 100 lines.  The
problem is that thread libraries like that are rare.

Although I'm willing to add support for reasonably widely used threads
packages, I generally try to discourage use of nonstandard threads
packages on platforms where there is a well-defined standard.  One
problem is that libraries are likely to "know" which threads package
they're running on, and threads packages don't mix.


> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com
> [mailto:gc-bounces at napali.hpl.hp.com]On Behalf Of Brian Kahne
> Sent: Monday, June 14, 2004 12:27 PM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] gc and quickthreads
> Hi,
> I was wondering whether anyone could describe how to 
> interface the garbage 
> collector with a user-threads package such as Quickthreads.  
> Does anyone have 
> any examples?  How do I go about telling the collector about 
> new threads?  Is 
> this a fairly straightforward process?
> Thanks for any help,
> Brian Kahne
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list