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

hall@eclipse.stanford.edu (Keith Hall) (10/10/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