concurrent garbage collection and POSIX threads

"Rafael R. Sevilla" <[email protected]> Wed, 06 Jan 2010 14:14:30 +0800
Newsgroups gmane.comp.programming.garbage-collection.general
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigF3E1C7B40175D7BF7D128480
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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?

--=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


--------------enigF3E1C7B40175D7BF7D128480
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktEKkgACgkQrStKv+reUJJG3wCgiKy9ZZZI6NK+UWBiek0KnFX5
bXUAn2Cwo5aERXLTP69LKdgw+JJLsPbq
=1Csl
-----END PGP SIGNATURE-----

--------------enigF3E1C7B40175D7BF7D128480--