[gclist] Using GC in embedded system

David Chase chase@world.std.com
Tue, 15 Jan 2002 12:40:30 -0500


At 08:53 AM 1/15/2002 -0800, Wink Saville wrote:
>I'm interested in using a GC in an embedded system and was wondering how
>feasible it is to create a program using C++ that has multiple threads with
>some threads having there memory GC'd. The problem is some of the threads
>will be involved in handling real time information and I don't want them to
>be delayed while a garbage collection cycle is occurring.

Could be done.  It would require some hacking on the Boehm-Weiser collector,
but nothing tremendously out of the ordinary.  You'd need to create a
small set of leave-me-alone threads that the collector would ignore.
Necessarily, these threads must either not play with heap pointers, or
register them while it did handle them ("register" is pretty easy --
just be sure that there is a globally accessible array of registered
pointers).

>Is this possible at all?

Yes.

>Is there a GC that will allow this type of segmentation in the system?

NaturalBridge's BulletTrain (Java, not C++) runtime works along these
lines.  Threads executing native code are not harrassed by the collector,
though these threads are delayed if they attempt to interact with the
VM during a collection.  This is with a compacting collector, but JNI
ref translation fills the role of "registration".  

David