[comp.sys.sgi] Multiprocessor Port

pabuhr@watmsg.waterloo.edu (Peter A. Buhr) (04/10/90)

First, I don't read this newsgroup so please post directly to me and I will
summarize any useful information.

I am trying to port the uSystem light-weight tasking library (see below) to
the SGI machine. A uSystem light-weight task seems to be significantly
lighter-weight than those provided through "sproc" on the SGI. For example,
a uSystem LWT can be created 34 times faster than one created by "sproc"
(3400 usecs vs. 100 usecs).  We have successfully ported the uSystem to an
SGI machine so that it runs in a single UNIX process simulating concurrency
using time-slicing.

I have started to extend the SGI port to take advantage of the multiple
processors.  I use shared UNIX ("sproc") processes as virtual processors
and schedule the uSystem LWTs among these virtual processors. I can create
the virtual processors easily using "sproc". What I can't seem to do is
build a light-weight semaphore.  There appears to be no
test-and-set/cache-coherent mechanism like on a Sequent Symmetry or Encore.
However, I have been told that there are some hardware locks (possibly like
a Sequent Balance).  Unfortunately, I cannot find any information on these
hardware locks.

So my question is this: what is the best mechanism on the SGI to build a
light-weight semaphore?  Having to enter the UNIX kernel to do this would
only be considered as a last resort as this would not be considered a
light-weight semaphore.

Thanks in advance.

========================================================================

The uSystem is a library of C routines that provide light-weight
concurrency on uniprocessor and multiprocessor computers running the UNIX
operating system.  Concurrent operations in the uSystem are explicitly
specified and not inferred from existing constructs in C.  Users first
design algorithms that are inherently concurrent and then explicitly code
corresponding concurrent operations using the routines in the uSystem.

The uSystem uses a shared-memory model of concurrency.  This shared-memory
is populated by subroutines, coroutines and concurrently executing
light-weight processes, called tasks.  Coroutine mechanisms are provided to
create coroutines within a task and to communicate information among the
coroutines.  Concurrency mechanisms are provided to create tasks, to
synchronize execution of the tasks, and to communicate information between
synchronized tasks, for example, P&V and send/receive/reply. When shared
memory exists between UNIX processes, UNIX processes are used as virtual
processors and task execution is uniformly distributed across them.  A
clustering mechanism exists to group virtual processors and tasks together,
restricting execution of these tasks to only these virtual processors.
Partitioning into clusters must be used with care as it has the potential
to inhibit concurrency when used indiscriminately.  However, in several
situations it is essential, for example, concurrent UNIX I/O operations are
possible through the clustering mechanism, when shared memory exists
between UNIX processes.

Currently, the uniprocessor form of the uSystem is supported on the
following computers: DEC Vax, Apollo 68K, Sun3 (68K), MIPS, and Sequent
Symmetry.  There is also a multiprocessor form for the Sequent Symmetry
S27. It requires GNU C 1.35 for all computers except the MIPS, which
requires GNU C 1.36.  The uSystem will NOT compile using other compilers.
As well, on the Sequent gcc must be installed with the Sequent assembler as
the GNU assembler does not handle the assembler directives generated from
gcc when the -fshared-data flag is used.

Currently, under development are tools for concurrent exception handle
and monitoring tools.


The uMonitor preprocessor is a C preprocessor that provides monitors for
use in control and communication among concurrent tasks created through the
uSystem.  The uMonitor preprocessor transforms new programming language
statements pertaining to monitors into C language statements and calls to
uSystem routines.  10 different kinds of monitors are provided.


The uSystem can be obtained by anonymous ftp from the following location:

   watmsg.waterloo.edu (129.97.129.9)   pub/uSystem/uSystem.tar.Z

The distribution file is in compressed tar format. Execute the following
commands to unpack the source:

   uncompress uSystem.tar.Z
   tar -xf uSystem.tar

The README file contains all the installation instructions. Good luck and
happy concurrency.

jwag@moose.sgi.com (Chris Wagner) (04/11/90)

I suggest you look at the manual apges for usinit(3P), usplock, uspsema,
barrier, m_fork

These are all located in libmpc.a - a full libc with you favorite
routines (stdio, malloc, rand)
single threaded, as well as a set of parallel programming facilities -
semaphores (counting)
spinlocks, barriers.


Chris Wagner