RE: libgc (a.k.a. Boehm's gc) on top of NGPT (Ne xt Generation Posix Threads)
"Boehm, Hans" <[email protected]>
| Newsgroups | gmane.linux.ngpt.devel |
|---|---|
| Message-ID | <[email protected]> |
Does the NGPT version of pthread_suspend_np wait until the target thread is stopped, even if it's running on a separate processor? I quickly looked at the source, but I couldn't figure out why pth_suspend is safe on a multiprocessor at all. Did I miss a lock that prevents t -> state from changing out from under it? It looks to me like it would require a moderate amount of conditionally compiled code in linux_threads.c in the GC distribution to support NGPT with pthread_suspend_np(). But that still seems preferable to treating it as a different port, since there is a considerably larger amount of shared code. The Solaris code that explicitly stops lwps should not be used as a model. I would like to get rid of it for Solaris as well. It's rather brittle and doesn't support parallel collection. Having signals run implicitly on a different stack may be problematic for the GC, if signals can occur during normal mono execution. It would mean that the collector would need to be prepared to deal with such an "out of bounds" stack pointer, which it currently isn't. Hans -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Monday, June 24, 2002 5:33 AM To: Marijn Ros Cc: [email protected]; [email protected] Subject: Re: [pthreads-devel] libgc (a.k.a. Boehm's gc) on top of NGPT (Next Generation Posix Threads) On 06/22/2002 at 10:39:08 PM ZE2, Marijn Ros <[email protected]> wrote: > > [This mail is sent to both Hans Boehm (the author of libgc) and > pthreads-devel (the NGPT development list)] > > I hope my english is good anough to explain my ideas. Good enough for me!!! > > I want to try to port libgc to run on top of NGPT, because I would > like to be able to run mono on top of that combination. > > Unfortunately, NGPT is not binary compatible anough with linuxthreads > for libgc to work. E.g., libgc uses signals to stop the world and at > the same time find the stack-pointer (on linux, that is), but NGPT > redirects signals to a different stack using sigaltstack. > > As I understand it, all libgc needs is a way to suspend all 'other' > threads, get their stack-pointers (GC_stop_world) and finally let the > 'other' threads continue again (GC_start_world). NGPT has just what you're looking for. There are two np (non-POSIX) apis that are just what is needed. They are pthread_suspend_np and pthread_resume_np. libgc should be able to iterate over the running threads and suspend and resume as needed. A third np api can then be called to retrieve the context (including the stack ptr) of the suspended thread. These apis are used by the IBM jvm currently being ported to take advantage of NGPT and they are up to the job. Regards, Bill Abt Senior Software Engineer Next Generation POSIX Threading for Linux IBM Cambridge, MA, USA 02142 Ext: +(00)1 603-673-3440 T/L: 253-9938 Cell: +(00)1 617-803-7514 [email protected] or [email protected] http://oss.software.ibm.com/developerworks/opensource/pthreads