PTL - Portable Thread Library
Note: All information in this page is out-of-date. Modern operating systems have multi-threading function so PTL is no longer useful.
PTL - Portable Thread Library
Top Page ->
Original APIs
Supported APIs
Debugger

   PTL - Portable Thread Library

English / Japanese

  News

  • Dec/13/2002 NetBSD pkgsrc for PTL-2.1.9 is available
  • Dec/04/2002 PTL-2.1.9 is released (NEWS)
  • Nov/27/2002 PTL-2.1.9rc2 (release candidate 2) is available
  • Nov/26/2002 PTL-2.1.9rc1 (release candidate 1) is available
  • Mar/02/2001 PTL-2.1.8 is released

  Table of contents

  What is PTL?

PTL is an implementation of a user level multi-thread library runs on UNIXes. With PTL, you can create and control multiple threads (control flow) in a single UNIX process.

For example, PTL can be used for following purposes.

  • Run programs using POSIX threads (Pthreads),
  • Network server/client programs,
  • Concurrent processing,
  • Simulating distributed or parallel algorithms,
  • Study of multi threaded programming.

Current version of PTL is based on POSIX 1003.1c API and is called PTL2 . Old one based on POSIX 1003.4a/Draft6 is called PTL1.

  Features

  • Provides almost all POSIX 1003.1c (Pthreads) APIs.
  • Works on most BSD UNIXes; No CPU dependency.
  • On SYSV UNIX, PTL may work on i386, SPARC, m68k, mips, alpha boxes if you have gcc.
  • Easy to install (./configure and make)
  • Free
  • Fast (maybe)
  • Provides preemption
  • On I/O operations such as network, terminal, pipe, SYSV message queue and SYSV semaphore, only the calling thread blocks and other threads can continue its execution.
  • Provides a simple debugger called PDB, which resides in the process, to help you to examine the threads status.

If you like talking in POSIX way, the following preprocessor symbols are defined.

  • #define _POSIX_THREADS
  • #define _POSIX_THREAD_ATTR_STACKSIZE
  • #define _POSIX_THREAD_PRIORITY_SCHEDULING
  • #define _POSIX_THREAD_PRIO_INHERIT (not well tested and maybe buggy)
  • #define _POSIX_THREAD_SAFE_FUNCTIONS

And the following are not.

  • #undef _POSIX_THREAD_ATTR_STACKADDR
  • #undef _POSIX_THREAD_PRIO_PROTECT
  • #undef _POSIX_THREAD_PROCESS_SHARED

  Installation

On NetBSD and FreeBSD, PTL can be installed using their package system.

To install PTL manually, please follow the instruction (INSTALL) in the PTL distribution.

Note that PTL does not work on recent glibc based systems such as Redhat Linux. Glibc contains their own pthread APIs and PTL conflicts with them.

PTL is confirmed to work on the following operating systems.Please report to me if PTL works on machines not listed here.

OS Note
SunOS4 (SPARC) use gcc
Solaris2.5.1 (SPARC, x86) use gcc
Solaris2.6 (SPARC) use gcc
Solaris7 (x86) use gcc
Redhat Linux 5.2 (x86)
BSD/OS2.1 (x86)
NEWS-OS4.2.1R (mips) use gcc
HP-UX A.09.07 (PA-RISC) use /bin/cc (setenv CCOPTS -Ae)

  Documentation

  Acknowledgments

I would like to thank the following people who have contributed to PTL (alphabetical order)

  • Yasufumi Itoh
  • Yoshio Iwai
  • Youki Kadobayashi
  • Toshio Matsuura
  • Hiroshi Saitoh
  • Masanobu Saitoh
  • Noriyuki Soda
  • Shigeya Senda
  • Hiroki Tatsumoto

Keywords for search engines: PTL, Portable Thread Library, pthreads, multi-threading, POSIX, 1003.1, 1003.1c, 1003.4a