[comp.archives] [gnu.g++.lib.bug] Thread library for G++

grunwald@FOOBAR.COLORADO.EDU (Dirk Grunwald) (07/11/90)

Archive-name: awesime/10-Jul-90
Original-posting-by: grunwald@FOOBAR.COLORADO.EDU (Dirk Grunwald)
Original-subject: Thread library for G++
Archive-site: foobar.colorado.edu [128.138.243.105]
Archive-directory: Awesime
Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)


well, I've put together a draft copy of my aforementioned tasking
library.

Anonymous ftp to foobar.colorado.edu (128.138.243.105) & grab
Awesime/awe2-0.1.tar.Z and unpack it. File 'Install' includes
installation directions. File 'Overview.txt' gives a (more or less)
current overview of the current system. The Examples directory gives 3
or 4 programs that use the library. The Documentation directory is
very out of date, and spends a lot of time documenting the code I
already donated to libg++.

The easiest way to use it is to look at the examples.

You need to use GNU make to install this package, although that might
change some day (particularly if it gets into libg++).

The machines where it should be easy to install:

	+ sparc
	+ sun3 & other 68K machines, I think
	+ pmax (if you can get g++ working)
	+ ns32k machines
	
porting to a VAX or a i386 should be simple, but I haven't done it.
Similarly, m88K.

Threads malloc a stack. Stack overflow is a common problem.  The SPARC
port provides three levels of stack overflow protection: none, wimpy
and strong. Strong is done by placing an 'mprotect()'-ed page
underneath each thread stack frame. This is how SunOS LWP does it, I
think. The pmax port will do this soon too. Using this option sucks
down more memory than you'd care to guess, and makes things run slower
too (a lot of mprotect calls) if you create/destroy many threads.

There are currently two versions of the thread supervisor (CpuMux &
SimMux) code. One uses single inheritence and the other uses multiple
inheritence. I think that the MI code works, but G++ has consistently
barfed on it, either during compiliation or runtime. The runtime
errors always appear to be G++ errors, not mine. But I haven't tried
it with the most recent G++, so who knows.

It anyone writes some more example programs, e.g. dining phil's or
something, please send mail.

Also, I'm in the midst of updating Src/malloc.c to work in a shared
memory parallel environment using the SpinLock.h class. If anyone has
time & interest, please go ahead & try it. The class SharedMalloc.c
contains an (older) version of malloc that is shared & secure.

If you port this to some other platform, let me know. If someone
starts to integrate it with libg++, again, let me know. I'd like to
get the interface standardized so people can start expanding things.

Dirk Grunwald -- Univ. of Colorado at Boulder	(grunwald@foobar.colorado.edu)
						(grunwald@boulder.colorado.edu)