T-Threads, a Light-weight Thread Package
Design Thread
API's Examples
Source
Code
How To Build On Your Machine
Slides
From a Talk People
Questions/Comments
Bug Reports
Design:
Threads are units of concurrent execution. T-Threads is a C++ object
oriented thread-package where threads and synchronization primitives
are objects with operations to initialize, run, and block . We have
built the the thread package with three main design goals: performance,
portability, extensibility and usablity.
Performance
A thread package can either be implemented as a pure user-level thread
package, a kernel-level thread package or a hybrid-implementation
that takes advantage of both schemes. A strictly user-level thread package
has the disadvantage that they cannot make use of multiple processors in
a box (threads cannot migrate from one processor to another). Kernel-level
threads can take advantage of parallelism but it is very inefficient because
it requires communication with the O.S. Kernel through system calls. For
example, each creation of a thread requires a system call. In a hybrid
scheme, we initially create a kernel-level thread per CPU. These kernel-threads,
called workers, then create and schedule user-level threads which may move
from one worker to another to balance the load by using work queues. This
hybrid scheme, sometimes known as a two-level scheduling implementation,
has the best of both worlds: like user-level threads they incur little
overhead and like kernel-level threads, we can make use of multiple CPU's.
Another way in which T-Threads improve performance is by taking advantage
of any hardware provisions provided by a particular architecture. A comparison
of T-Threads with other thread packages can be found here.
Portability
T-threads library has been ported to many architectures and operating
systems, including i386/i486/pentium processors running Linux,
DEC Alpha running OSF/1. SPARC stations running Solaris, and R8000/R10000
running SGI IRIX and it is currently being ported to IBM/SP2.
Extensibility
In T-Threads, threads and primitives required in thread library such
as mutexes and barriers are C++ objects that can be specialized by
users to suit their purposes. By subclassing the basic primitives
provided by the package, users can adapt the package for their needs.
Usability
T-Threads supports important interface such as HPC++ Thread Interface
and a subset of the Pthreads interface.
T-Thread API's:
An API Based on HPC++ Thread Interface):
PThreads API:
-
pthread_attr_init
-
pthread_attr_setstacksize
-
pthread_condattr_init
-
pthread_mutexattr_init
-
pthread_mutex_init
-
pthread_cond_init
-
pthread_create
-
pthread_mutex_lock
-
pthread_mutex_unlock
-
pthread_cond_broadcast
-
pthread_cond_wait
How To Bulid on Your Machine:
Tulip Thread library is currently ported to:
SGI Origin multiprocessors (using the native compiler CC)
Sun Sparc stations (using the native compiler CC and gnumake)
Intel 0x86 . (using g++)
DEC Alpha multiprocessors (using the native compiler cxx)
To build the thread library:
1. Make sure that HOSTTYPE environment variable is set to one of the
following:
a. iris4d
b. i386-linux
c. sun4
d. alpha
2. Edit the Tulip_Config.h file in $ROOT/include
3. Make the library by doing "make" from $ROOT$/Tuliplib.
4. Try some examples in $ROOT$/examples.
People
Suvas
Vajracharya
Dirk
Grunwald
Pete
Beckman
Dennis
Gannon
Other Contributors: