Re: concurrent garbage collection and POSIX threads

Xiao-Feng Li <[email protected]> Thu, 7 Jan 2010 16:18:19 +0800
Newsgroups gmane.comp.programming.garbage-collection.general
Message-ID <[email protected]>
In Apache Harmony, we firstly implemented this kind of "preemptive"
suspend/resume for both Linux/Windows, but then we threw away the idea
and took the "voluntary" suspend/resume approach, where the threads
poll for GC request and then suspend themselves. This is much easier
or safer than the preemptive approach. In Interpreter the pollings are
hardcoded, and in JIT compiler they are inserted by JIT at the GC
safepoints.

Thanks,
xiaofeng

On Wed, Jan 6, 2010 at 2:14 PM, Rafael R. Sevilla <[email protected]> wrote:
> I'm attempting to implement a concurrent garbage collector (specifically
> the Huelsbergen-Winterbottom VCGC algorithm) for a small compiled
> language I'm working on and they it requires that one be able to pause
> execution of all running threads during a barrier synchronization event
> at the end of a garbage collection epoch, and then resume execution of
> these threads afterwards.  I believe many other concurrent garbage
> collection algorithms have similar requirements.  How would one
> implement this using POSIX.1b/1c primitives alone?  The pause and resume
>  are in general asynchronous.  I've thought up a rather convoluted
> method that involves adding a signal handler for each thread, which upon
> receipt of a POSIX real time signal, does a wait on a condition
> variable.  When the thread is to be resumed, the condition variable is
> signaled, causing all threads waiting on it to resume execution, at
> which point the signal handler returns and execution resumes.
>
> I wonder if there is an easier way to do this that does not require
> these kinds of contortions.   There are thr_suspend/thr_resume calls in
> Solaris, and in older versions of Linux using LinuxThreads it was
> possible to use SIGSTOP/SIGCONT on the thread ID, but with NPTL, which
> is now fully POSIX-compliant, the use of those signal would stop all
> threads, which I do not want.  Any hints from those who have implemented
> such garbage collectors?
>
> --
> 存在するということは、自分を創造することだ。
> http://stormwyrm.blogspot.com
>
>



-- 
http://people.apache.org/~xli