The Qthreads Library

The qthreads API is designed to make using large numbers of lightweight threads convenient and easy, and to allow portable access to threading constructs used in massively parallel shared memory environments. The API maps well to both MTA-style threading and PIM-style threading, and is still quite useful in a standard SMP context. The qthreads API provides access to full/empty-bit (FEB) semantics, where every word of memory can be marked either full or empty, and a thread can wait for any word to attain either state.

The qthreads library on an SMP (i.e. the POSIX implementation) is essentially a library for spawning and controlling coroutines: threads with small O(4k) stacks. The threads are entirely in user-space and use their blocked/unblocked status as part of their scheduling. The library’s metaphor is that there are many qthreads and several “shepherds”. Shepherds can be thought of as a thread mobility domain; they map to specific processors or memory regions. Qthreads are assigned to specific shepherds and do not migrate unless directed to migrate or if load balancing via work stealing is enabled.

The API includes utility functions for making threaded loops, sorting, and similar operations convenient.

The qthreads library was developed to explore innovations in highly concurrent systems where the ultimate system either does not exist, or is sufficiently hard to obtain that development of software for the system becomes difficult.

Development and releases are currently hosted on GitHub: https://github.com/sandialabs/qthreads.

Documentation is included in the repository itself and in the releases, including man pages that install with the distribution, and a user guide that can be compiled using LaTex.

Platforms and Requirements

ArchitectureLinuxMac OS XSolaris SST
x86 64-bit
Arm 64-bitNew New
PPC 64-bit
x86 32-bit
Arm 32-bit
PPC 32-bit
Sparc V9+
Tilera (MIPS)
Architectures that qthreads runs on, or has run on in the past. Note that the current focus is on 64-bit architectures, and the Qthreads team does not regularly test on 32-bit architectures, Sparc, or Tilera at this time.

Build Requirements

To compile and run Qthreads over POSIX you will require:

  • A UNIX-like shell (Qthreads uses the GNU Autotools)
  • GNU Make
  • C Compiler (Prior to 1.5 requires either C++ or the cprops library)

Publications

To cite Qthreads:

Related Papers: