Re: concurrent garbage collection and POSIX threads
leland <[email protected]> Sat, 9 Jan 2010 04:14:56 +0800 (CST)
| Newsgroups | gmane.comp.programming.garbage-collection.general |
|---|---|
| Message-ID | <[email protected]> |
--- On Tue, 1/5/10, Rafael R. Sevilla <[email protected]> wrote: > From: Rafael R. Sevilla <[email protected]> > Subject: [gclist] concurrent garbage collection and POSIX threads > To: [email protected] > Received: Tuesday, January 5, 2010, 10:14 PM > 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.=C2=A0 I believe many other > concurrent garbage > collection algorithms have similar requirements.=C2=A0 How > would one > implement this using POSIX.1b/1c primitives alone?=C2=A0 > The pause and resume >=C2=A0 are in general asynchronous.=C2=A0 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.=C2=A0 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. >=20 > I wonder if there is an easier way to do this that does not > require > these kinds of contortions.=C2=A0=C2=A0=C2=A0There 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.=C2=A0 Any hints from those > who have implemented > such garbage collectors? >=20 > --=20 > =E5=AD=98=E5=9C=A8=E3=81=99=E3=82=8B=E3=81=A8=E3=81=84=E3=81=86=E3=81=93= =E3=81=A8=E3=81=AF=E3=80=81=E8=87=AA=E5=88=86=E3=82=92=E5=89=B5=E9=80=A0=E3= =81=99=E3=82=8B=E3=81=93=E3=81=A8=E3=81=A0=E3=80=82 > http://stormwyrm.blogspot.com >=20 > You don't have to pause any execution of app threads for a concurrent garba= ge collector. A full concurrent garbage collector can run as a lowest prior= ity thread, and never invoke any thr_suspend/resume the like calls. - Mingnan Guo