threads primer pkgs

Pascal It is possible to call the threads functions directly from Pascal, merely linking in the library. To do so, you'll need appropriate ".h" files for Pascal. These are included in the Sun Pascal distribution for an interface to UI threads as thread_p.h and synch_p.h. Some of Sun's Pascal support is being done in Russia and the above link points to a short page at the University of Saint Petersburg which shows a few of the "Threads Primer" demonstration programs done in Pascal. (This is the only MT Pascal we're aware of.)

SmallTalk Object Connect +33 558 82 84 72 This is a threaded version o f Smalltalk which is based on Win32 threads and can make use of all of the functionality of the Win32 Threads API. It ispossible to callSmalltalk objects which implement the functionality, or to call the various functions directly via a foreign language interface. Smalltalk blocks can also be called from other programs and all of the threads functions, synchronization, etc. will work across both. It has the capability to build stand-alone EXEs and DLLs callable from other languages, and support for building ActiveX components. The Smalltalk MT system includes a graphical, interactive, multithreaded debugger, and a garbage collector that runs in a background thread.

Lisp The Japanese Electrotechnical Laboratory has a project, EusLisp, which implements threads inside of an (almost) Common Lisp language/environment. It allows you to build threads in a POSIX style, run on multiple processors, and use POSIX-like synchronization. It runs on Solaris 2 and is based on the underlying UI threads library.

Eiffel ISE Inc. (805) 685-1006 Eiffel is a language designed and marketed by Bertram Meyer and his company in France. It is a strict, object-oriented language with enforced static typing. In its latest release (4.1, March 1997), Eiffel provides a threads library on Win32 and Solaris (others to come) which maps directly onto the native threads libraries. Shared objects are implemented by using proxy objects which do all of the synchronization for you (at a cost, of course). A different approach to threading will be provided in a later release in which a language construct (Thread-SCOOP) will do all of the synchronization for you. Eiffel is also a garbage collected language and the GC has been extended to work with threads. Because objects cannot be shared directly between different threads, Eiffel can use a per-thread GC.

Commercial Libraries There are a number of companies which write thread-oriented libraries for a variety of purposes. You might find some of these useful.

ObjectSpace (800) 625-3281 The ObjectSpace C++ Component Series provides a full set of features ranging from a portable implementation of the C++ Standard Template Library to libraries for systems programming and World Wide Web development. All libraries are portable across popular hardware platforms, operating systems, and compilers, and are safe for use in multithreaded environments. Full source portability for threads and synchronization is available on a wide variety of platforms. Thread is one library in their C++ Component Series that specializes in classes for multithreaded development, and includes a variety of classes useful for creating and synchronizing threads .

RogueWave (800) 487-3217 The Threads.h++ provides C++ objects for thread functionality and handles the low-level details of multithreading for you, portable across: Win NT, Win 95, Solaris, HP-UX, AIX, Digital Unix, IRIX, and OS/2. The runnable classes provide: simple synchronous classes that use existing threads to perform their tasks, threaded classes that create their own threads to accomplish their tasks, and runnable servers that accept other runnable objects for execution in each server's own thread or threads. The thread creation paradigm uses functors (essentially an encapsulated object plus method) instead of function plus (void *) argument. It also provides for lazy evaluation-the ability to have a function return an IOU for a value whose calculation might take a while to complete. Synchronization objects include: critical sections, simple mutexes, fifo mutexes, recursive mutexes, condition variables, semaphores, readers-writer locks, barriers, and guard classes.

Geodesic Systems, LLC (800) 360-8388 Great Circle is both a conservative garbage collector that can be linked into existing applications (no changes required), and a "smart" GC that can be integrated into applications (hence changes required). It works with C and C++ programs and libraries, effectively eliminating the vast, vast majority of problems of memory leaks. It also shadows calls to free() and prevents premature recycling of memory. It works with multithreaded programs and runs on numerous platforms, including Solaris, SunOS, HP-UX, Windows NT/95; with more on the way. Although somewhat difficult to do exact comparisons, the best estimations show a GC'd version of X Windows system running 25% faster than the standard version. Garbage collection is a wonderful thing which vastly simplifies your programming task, letting you concentrate your efforts on writing your program, not trying to follow memory leaks. While we do not want to endorse any particular product here, we do wish to endorse the concept.

Dakota Scientific Software (800) 641-8851 Although not specifically a multithreading company, Dakota is notable for their extensive use of threads in their products, high-performance numerical libraries which are used in thousands of scientific programs. For this purpose, threads are just one of many means towards the ultimate end of high-performance libraries. Even their single-CPU LAPACK, LINPACK, BLAS libraries run upwards of an order of magnitude faster than naive implementations. Libraries are available for FORTRAN, C, and C++. Dakota also has a series of coproducts called FastMath that accelerate other mathematical products including Math.h++ and LAPACK.h++ from Rogue Wave, POOMA from Los Alamos National Laboratory, IDL from Research Systems, Inc., and others. Finally, Dakota does extensive consulting and contract optimization using threads and other techniques.

Adaptive Communication Environment The Adaptive Communication Environment (ACE) is an object-oriented toolkit that implements fundamental design patterns for communication software. ACE provides a rich set of reusable C++ wrappers, class categories, and frameworks that perform common communication software tasks across a range of operating system platforms. The communication software tasks provided by ACE include event demultiplexing and event handler dispatching, service initialization, interprocess communication, shared memory management, message routing, dynamic (re)configuration of distributed services, multi-threading, and concurrency control. ACE has been ported to a wide range of uni-processor and multi-process OS platforms including Win32 (i.e., Win NT and Win95), most versions of UNIX (e.g., SunOS 4.x and 5.x, SGI IRIX, DG/UX, HP-UX, OSF/1, AIX, Linux, and SCO), VxWorks, and MVS OpenEdition. It is currently used in commercial products by dozens of companies. There are C++ and Java versions of ACE available.

Centerline (415) 943-2114 C++Expert is a tool that performs comprehensive error checking of C and C++ programs throughout the development cycle: at compile time, link time, and run time. Its run time error detection works by analyzing the program source code and generating error-checking instrumentation based on that analysis. The errors it catches include: incorrect use of typed pointers (resulting from improper casts), using freed pointers, freeing a pointer twice, array bounds checking, and memory leaks Furthermore, C++Expert was carefully designed from scratch to be robust in the presence of multithreaded applications.

GNU (via Cygnus) (800) 294-6871 GDB, the GNU debugger, has been extended by Cygnus Support to support the debugging of multithreaded programs. It does not yet have a graphical user interface, but does provide the base functionality required.

Pure Software (408) 720-1600 Pure Atria has its Run-Time memory error checker, Purify, which has been extended to work with multiple threads. It also has a performance monitoring tool, Quantify, which will show performance data for multithreaded programs.

Public Pthreads Implementations

FSU Pthreads As part of the PART project (POSIX / Ada-Runtime Project) Florida State University / Humboldt University Berlin have implemented a library package of preemptive threads which is compliant with POSIX 1003.4a Draft 6. The implementation runs under SunOS 4.1.x, Solaris 2.x, Linux, SCO, FreeBSD and DOS. The current scheduling policies are strict priority scheduling (according to POSIX.4a FIFO scheduling) which preempts when signals are caught or round-robin (RR scheduling) which changes context to another thread of the same priority after a time-slice of 20msec. Besides asynchronous delivery of signals, context switches only occur where required by the priority policy, e.g. when resources (mutexes) are locked etc.

MIT Portable Pthreads Christopher Angelo Provenzano heads a project which has written a Pthreads library which is portable across NetBSD, FreeBSD, LInux, SunOS 4.1, Solaris, Outrides, OSF/1, IRIX and HP-UX. It implements the full POSIX standard in a Many-to-One model.

PCThreads Michael T. Peterson has written a Pthreads library for Linux. It is a Many-to-One model with a series of extensions in several of the system libraries to allow them to run in a non-blocking mode. The various blocking system calls are wrapped by "jacket" routines for the threads library. This allow several threads to make blocking calls which are turned into their non-blocking equivalents, allowing yet another thread to continue running. It is included in the current Linux release. It is also available for FTP from the address above.

LinuxThreads Xavier Leroy at INRIA (Paris, France), with input from Pavel Krauz, Richard Henderson and others, has developed a Pthreads library which implements the One-to-One model, allowing it to take advantage of multiple processors. It is based on the new Linux system call, clone(). It runs on Linux 2.0 and up, on Intel, Alpha, SPARC, m68k, and MIPS machines. One limitation is its non-standaqrd implementation of signal handling.

Pthread Debugger Project: SmartGDB A team at the University of Kansas has built a debugger atop GDB. It is designed to allow the user to tailor it to his application environment. It supports MIT pthreads on Linux and allows extension to other thread packages. A tcl/tk interpreter makes scripting possible. Some of the unique aspects of this debugger include: Checking for data races. Monitoring number of threads accessing a certain critical section. Checking for deadlocks. Forcing the program to follow a specific context switching sequence to reproduce aberrant behavior. Declaring thread-specific breakpoints.