[Mono-list] solution for Thread::Abort()
Fri, 9 Aug 2002 20:02:30 +1000
On 09-Aug-2002, Piers Haken <email@example.com> wrote:
> Can someone summarize how the boehm GC handles multi-threaded applications
The Boehm GC uses a stop-the-world approach: when a thread decides
that it needs to do a garbage collection, it calls GC_stop_world(),
which suspends all the other threads. This is done using by sending
signals to them using pthread_kill(), and waiting until they suspended.
The technique is essentially the same as the one mentioned in
Then, once all the threads have been suspended, the Boehm collector
goes ahead and does garbage collection. In earlier versions,
this was done completely single-threaded; more recent versions
have a compilation option "-DPARALLEL_MARK" which lets the mark
phase of collection use multiple threads. (This is documented at
Finally, once collection is complete, the suspended threads are resumed
In general, with this sort of approach, it is necessary to advance each
thread to a GC-safe point before starting a collection. Since the Boehm
collector is conservative, every instruction is a GC-safe point, so this
step is not needed. That makes things a bit easier.
Fergus Henderson <firstname.lastname@example.org> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.