Promoting Linux Requires Advertising. It Matters To Me. TM
GnuCash Personal Finance Manager
GnuCash!

Linux Threads Frequently Asked Questions (FAQ)

by Sean Walton, KB7rfa

walton@oclc.org

(Last revised 19 Sep 1996)

See also: This mirror in Italy ... may speed your access.

Caution

This FAQ is more than a two years out-of-date. POSIX-threads are now a standard part of all modern Linux distributions. The new glibc version 2 (linux libc version 6.0) is fully re-entrant and supports threads in a fully compliant manner. The default Linux thread implementation is with kernel-space threads, not user-space threads; these threads will schedule properly on an SMP architecture.

You may still find this FAQ useful if you are looking for user-space threads, DCE threads, a non-standard threads API, or for threads tools for a language other than C/C++/perl/tcl/scheme, or if you are upgrading an older system. The "LinuxThreads" package (below) has become the default package for Linux distributions, so you will probably want that if upgrading. The MIT (Provenzano) threads package is popular among some folks.

Since Sean Walton has moved on to bigger & better things, there is currently no maintainer for the FAQ. If anyone wants to bring this FAQ up-to-date, or can offer an otherwise improved and updated FAQ, please contact me, Linas Vepstas, linas@linas.org and I will post your updates and/or redirect this page to your page.

Introduction

Limitations

Credits


INDEX

  1. What are threads (user/kernel)?
  2. What are the common problems with threads?
  3. Does Linux support threads?
  4. Are Linux threads the same as other implementations?
  5. Is the kernel 100% reentrant?
  6. Do the libraries support multithreading?
  7. What kinds of things should be threaded/multitasked?
  8. Are there threading libraries? Where?
  9. How are Linux threads accessed?
  10. Is there a system call I can use to access kernel threads?
  11. Are there ways to determine thread schedule ordering?
  12. Are there languages that support threads?
  13. How does one debug threads?
  14. What do the individual flags mean and do in clone()?
  15. What applications or libraries currently use threads?
  16. Where can I learn more about threads?


What are threads (user/kernel)?

User-Level Threads

Kernel-Level Threads

Combination


What are the common problems with threads?

Classic View

Concurrency Complexity


Does Linux support threads?


Are Linux threads the same as other implementations?


Is the kernel 100% reentrant?


Do the libraries support multithreading?


What kinds of things should be threaded or multitasked?


Are there threading libraries? Where?

Linux Threads Packages

Title: Bare-Bones Threads
Author: Christopher Neufeld
Repositories: [Documentation] [Source]
API: Non-standard
Description: This is a very basic, bare-bones threading package which has been tested on both single-CPU and SMP Linux boxes.
License: GPL(? Source is included)
Title: DCEthreads
Author: Michael T. Peterson
Repositories: [Documentation] [Source]
API: POSIX 1003.4c Draft 4 (?)
Description: PCthreads (tm) is a multithreading library for Linux-based Intel systems and is based on the POSIX 1003.1c standard. The kit contains the sources for the library (libpthreads), a build environment for building both ELF and A.OUT versions of the library, and a complete set of man pages for all POSIX .1c functions.
License: GPL(? Source is included)
Title: FSU Pthreads
Author: Frank Mueller
Repositories: [Documentation] [Documentation mirror] [Source] [Source mirror]
API: POSIX 1003.1c
Description: Pthreads is a C library which implements POSIX threads for SunOS 4.1.x, Solaris 2.x, SCO UNIX, FreeBSD and Linux. Used for GNU Ada Runtime; partial libc support.
License: Gnu Public Library License
Title: JKthread
Author: Jeff Koftinoff
Repositories: [Documentation] [Source]
API: Non-standard
Description: This is an experiment with the Linux 2.0 clone() call to implement usable kernel threads in a user program. These jkthreads have an API that has NOTHING to do with pthreads or Win32 threads or BeBox threads.
License: GPL (? Source is included)
Title: LinuxThreads
Author: Xavier Leroy
Repositories: [Documentation] [Source]
API: POSIX 1003.1c
Description: LinuxThreads is an implementation of the Posix 1003.1c thread package for Linux. Unlike other implementations of Posix threads, LinuxThreads provides kernel-level threads: threads are created with the new clone() system call and all scheduling is done in the kernel.
License: GNU LGPL
Title: LWP
Author: Stephen Crane
Repositories: [Documentation] [Source]
API: Non-standard
Description: A small portable lightweight process library for sun[34], mips-ultrix, 386BSD, HP-UX and Linux. (Man pages included)
License: GPL
Title: PCthreads
Author: Michael T. Peterson
Repositories: [Documentation] [Source]
API: POSIX 1003.1c
Description: User-space pthreads library; includes non-blocking select(), read(), and write(). Man pages included. Requires DCEThreads.
License: GPL (? Source is included)
Title: Provenzano Pthreads
Author: Christopher A. Provenzano
Repositories: [Documentation] [Source]
API: POSIX 1003.1c subset (lacks thread cancellation)
Description: User-space pthreads library distributed with Linux libc source but may not be built by default.
License: GPL (?)
Title: QuickThreads
Author: David Keppel
Repositories: [Documentation] [Source]
API: Non-standard
Description: A portable user-space threads package. Documentation written in PostScript.
License: Freeware (source).
Title: Radke Threads
Author: Thomas Radke
Repositories: [Documentation] [Source]
API: Non-standard
Description: User-level threads package included with patches to Linux kernel to support kernel threading. (Includes man pages)
License: GPL (? Source is included)


How are Linux kernel threads accessed?

Language Access

Kernel Access


Is there a system call I can use to access kernel threads?


Are there ways currently to determine thread schedule ordering?


Are there languages that support threads?

Threading Languages

Titles: Ada/Ed
Author: New York University
Repositories: [Documentation] [Source]
Newsgroup: comp.lang.ada
Threads Lib: LinuxThreads
Description: Ada/Ed is a translator-interpreter for Ada. It is intended as a teaching tool and does not have the capacity, performance or robustness of commercial Ada compilers. Ada/Ed was developed as a long-range project in language definition and software prototyping.
License: GPL
Title: Gnat
Author: New York University
Repositories: [Documentation] [Source][SVGA Bindings]
Newsgroup: comp.lang.ada
Threads Lib: LinuxThreads
Description: GNAT is the Ada 95 compiler produced by a collaboration between a team at New York University and the Free Software Foundation, 'owner' of the GNU software project.
License: GPL
Title: Guavac & Kaffe (Java)
Author: ???
Repositories: [Guavac Documentation] [Kaffe Documentation]

[Gauvac Source] [Kaffe Source]

Newsgroup:
Threads Lib: ???
Description: Guavac is a new compiler for the Java language, written by Effective Edge Technologies and distributed under the Gnu Public License. You should feel free to use, copy and modify it, based on the terms in the COPYING file included in this distribution.

Kaffe is a virtual machine design to execute Java bytecode. Unlike other virtual machines available, this machine performs "just-in-time" code conversion from the abstract code to the host machine's native code. This will ultimately allow execution of Java code at the same speed as standard compiled code but while maintaining the advantages and flexibility of code independence.

License: GPL
Title: Modula-3/m3gdb
Author: DEC Systems Research Center
Repositories: [Documentation] [Source]
Newsgroup: comp.lang.modula-3
Threads Lib: (Uses own?)
Description: Compiler, tools, applications and libraries for Modula-3, a simple and efficient modular, imperative language. Modula-3 has objects, threads, exceptions and generics. The libraries include X toolkits, a user interface builder, an embedded interpreted language and network objects.

m3gdb is a GPL debugger for Modula-3.

License: (see copyright, freely usable and redistributable)
Title: Objective-C/Gnustep
Author: www.gnustep.org
Repositories: [Documentation] [Source]
Newsgroup: comp.lang.objective-c
Threads Lib: pthreads (user-level [kernel-level in development])
Description: objc-shared-patches contains a complete source of GNU Objective-C runtime and a diff file for libobjects-0.1.14, both patched to generate a shared Linux ELF library.
License: GPL
Title: Python 1.4
Author: www.python.org
Repositories: [Documentation][Binary][Source]
Newsgroup: comp.lang.python
Threads Lib: POSIX threads (Python Makefile supports user-/ kernel-level)
Description: Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java.
License: Freeware
Title: Sather
Author: ICSI
Repositories: [Documentation] [Source]
Newsgroup: comp.lang.sather
Threads Lib: POSIX Threads
Description: Sather is an object oriented language designed to be simple, efficient, safe, flexible and non-proprietary. One way of placing it in the "space of languages" is to say that it aims to be as efficient as C, C++, or Fortran, as elegant as and safer than Eiffel, and support higher-order functions and iteration abstraction as well as Common Lisp, CLU or Scheme.
License: Freeware (?)
Title: SmallTalkX
Author: ???
Repositories: [Documentation] [Source]
Newsgroup: comp.lang.smalltalk
Threads Lib: (Internal implementation of threads.)
Description: SmallTalk interpreter for X11. SmallTalk is an object-oriented, interpreted programming language. Often it is used in simulations or rapid prototyping.
License: Noncommercial (see `LICENSE')


How does one debug threads?

Modula-3

C/C++ (and anything compatible with gdb)


What do the individual flags mean and do in clone()?

Flag

Status

Description

CLONE_VM Done Share data and stack
CLONE_FS Done Share filesystem info
CLONE_FILES Done Share open files
CLONE_SIGHAND Done Share signals
CLONE_PID Almost Done Share PID with parent (problems with /proc and signals go to parent)


What applications or libraries currently use threads?

Thread-Using Packages/Libraries

Library: Adaptive Communication Environment (ACE)
Author: Douglas C. Schmidt
Repositories: [Documentation] [Source] [Mirror]
Threads Lib: LinuxThreads
Description: The ADAPTIVE Communication Environment (ACE) is an object-oriented programming toolkit for concurrent network applications and services. ACE encapsulates user-level UNIX and Win32 (Windows NT and Windows '95) OS mechanisms via portable, type-secure, efficient, and object-oriented interfaces. In addition, ACE contains a number of higher-level class categories and network programming frameworks. The following diagram illustrates the key components in ACE and their hierarchical relationships.
License: [License]
Title: AolServer
Author: www.aolserver.com
Repositories: [Source]
Threads Lib: (Uses internal system calls to clone()?)
Description: A free webserver (multiplatform) [Feature Sheet]
License: [License]
Title: Executor
Author: www.ardi.com
Repositories: [Source]
Threads Lib: ???
Description: A100% native software Macintosh emulator for PCs. Executor lets you read and write Mac-formatted high-density floppies and Mac SCSI drives, read Mac CDs, and run many Macintosh programs.
License: (commerial software)


Where can I learn more about threads?




Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included at the URL http://www.linas.org/fdl.html, the web page titled "GNU Free Documentation License".