[comp.os.research] threads for C/C++ under Unix?

hall@eclipse.stanford.edu (Keith Hall) (10/06/89)

  > From: nagle@well.UUCP (John Nagle)
  > What you really need is serious concurrency support.  Here's why.
  >   ...
  > Now how do we get multithread C++?

In his message, John elaborates the utility of lightweight processes.
I agree with him strongly.

As I understand, there is a "task library" that comes with C-Front
which offers coroutines.  What is the state-of-the-art in terms of a
(preferably public domain) portable Unix library that provides
*preemptive* (time-sliced) lightweight processes?  The C-threads
package in Mach would serve as a good model of functionality/interface.

Such a library should provide the usual primitives plus add a layer
atop the standard C-library which protects (thru semaphores) those
functions that require "state", such as malloc, printf, etc.  (The
state must be protected from inconsistent changes by concurrently
executing threads.  The lwp library in SunOS doesn't do this.)  That
layer must also allow threads to run while other threads are blocked
on I/O, etc., which may require that kernel functionality like read &
write be "approximated" with interspersed calls to select.

So, my questions to the net:
  1.  Does a portable preemptive thread package for Unix, such as
      described above, exist?
  2.  Is there a reason such a package cannot be written without
      kernel modifications?
  3.  If kernel mods are required, why haven't we programmer's
      demanded that they be done?  Put another way, is the utility
      of threads not generally recognized?

Thank you for your responses, either to this bboard or back to me.

Keith Hall
hall@eclipse.stanford.edu

grunwald@ncar.UCAR.EDU (Dirk Grunwald) (10/09/89)

Brown Threads does pretty much everything you want; I don't recall who
developed them, so I can't point you in the right direction.

However, I don't think you should fool with printf, other than making
it reentrent (which, on most systems, it isn't). You don't always want
I/O locking at the level of printf - typically across multiple printfs.
Malloc, on the other hand, must be fixed.

elm%chilli.Berkeley.EDU@ucbvax.Berkeley.EDU (ethan miller) (10/10/89)

In article <9358@saturn.ucsc.edu> boulder!foobar!grunwald@ncar.UCAR.EDU (Dirk Grunwald) writes:
%
%Brown Threads does pretty much everything you want; I don't recall who
%developed them, so I can't point you in the right direction.

They were developed by Tom Doeppner (I think that's how you spell his
name).  He was at Brown last I heard (the 1988-89 year), and his
e-mail is almost certainly still forwarded from twd@cs.brown.edu.

ethan
=================================
ethan miller--cs grad student   elm@ginger.berkeley.edu
#include <std/disclaimer.h>     {...}!ucbvax!ginger!elm
"I like the Austrian way better." -- Dr. Henry Jones, Jr.