icon Top 9 categories map      RocketAware > man pages >


Tips: Browse or Search all pages for efficient awareness of more than 6000 of the most popular reusable and open source applications, functions, libraries, and FAQs.

The "RKT couplings" below include links to source code, updates, additional information, advice, FAQs, and overviews.


Search all pages


By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Integer, Floating point, Matrix, Statistics, Boolean, ...

Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


RocketLink!--> Man page versions:

PTHREADS(3)               OpenBSD Programmer's Manual              PTHREADS(3)

     pthreads - POSIX 1003.1c thread interface

     A thread is a flow of control within a process.  Each thread represents a
     minimal amount of state; normally just the cpu state and a signal mask.
     All other process state (such as memory, file descriptors) is shared
     among all of the threads in the process.

     In OpenBSD, threads are implemented in a user-level library (libc_r) that
     replaces the standard C library (libc). This replacement is currently
     achieved by specifying the -pthread flag to cc(1) for each compilation
     unit, and for linking.  (But see the section on BUGS.)

     The SIGINFO signal can be sent to a threaded process to have the library
     show the state of all of its threads. The information is sent to the pro-
     cess' /dev/tty.

     Threads can be in one of these states:
           cond_wait     Executing pthread_cond_wait(3) or
           dead          Waiting for resource deallocation by the thread
                         garbage collector.
           deadlock      Waiting for a resource held by the thread itself.
           fdlr_wait     File descriptor read lock wait.
           fdlw_wait     File descriptor write lock wait.
           fdr_wait      Executing one of accept(2),  read(2),  readv(2),
                         recvfrom(2),  recvmsg(2).
           fdw_wait      Executing one of connect(2),  sendmsg(2),  sendto(2),
                          write(2),  writev(2).
           file_wait     Executing flockfile(3) or similar.
           join          Executing pthread_join(3).
           mutex_wait    Executing pthread_mutex_lock(3).
           running       Scheduled for, or engaged in, program execution.
           select_wait   Executing select(2).
           sigsuspend    Executing sigsuspend(2).
           sigwait       Executing sigwait(3).
           sleep_wait    Executing sleep(3) or nanosleep(2).
           spinblock     Waiting for a machine-level atomic lock.
           suspended     Suspended with pthread_suspend_np(3).
           wait_wait     Executing wait4(2) or similar.

   Scheduling algorithm
     The scheduling algorithm used by the user-level thread library is roughly
     as follows:
     1.   Threads each have a time slice credit which is debited by the actual
          time the thread spends in running.  Freshly scheduled threads are
          given a time slice credit of 100000 usec.
     2.   Give an incremental priority update to run-enabled threads that have
          not run since the last time that an incremental priority update was
          given to them.
     3.   Choose the next run-enabled thread with the highest priority, that
          became inactive least recently, and has the largest remaining time

     When all threads are blocked, the process also blocks.  When there are no
     threads remaining, the process terminates with an exit code of zero.

     pthread_cleanup_pop(3),  pthread_cleanup_push(3),
     pthread_cond_broadcast(3),  pthread_cond_destroy(3),
     pthread_cond_init(3),  pthread_cond_signal(3),
     pthread_cond_timedwait(3),  pthread_cond_wait(3),  pthread_create(3),
     pthread_detach(3),  pthread_equal(3),  pthread_exit(3),
     pthread_getspecific(3),  pthread_join(3),  pthread_key_create(3),
     pthread_key_delete(3),  pthread_mutex_destroy(3),  pthread_mutex_init(3),
      pthread_mutex_lock(3),  pthread_mutex_trylock(3),
     pthread_mutex_unlock(3),  pthread_once(3),  pthread_rwlock_destroy(3),
     pthread_rwlock_init(3),  pthread_rwlock_rdlock(3),
     pthread_rwlock_unlock(3),  pthread_rwlock_wrlock(3),
     pthread_rwlockattr_destroy(3),  pthread_rwlockattr_getpshared(3),
     pthread_rwlockattr_init(3),  pthread_rwlockattr_setpshared(3),
     pthread_self(3),  pthread_setspecific(3)

     The user-level thread library provides functions that conform to ISO/IEC
     9945-1 ANSI/IEEE (``POSIX'') Std 1003.1 Second Edition 1996-07-12.

     John Birrell (jb@freebsd.org) wrote the majority of the user level thread

     Having to pass the -pthread flag to cc(1) for every compilation unit and
     linking is an awful kludge.  Future releases will most likely depreceate
     this flag, and instead only use -lpthread during linking.

     The library contains of a scheduler that uses the process virtual inter-
     val timer to pre-empt running threads.  This means that using
     setitimer(2) to alter the process virtual timer will have undefined ef-
     fects. The SIGVTALRM will never be delivered to threads in a process.

     Due to the type definition of fd_set and the internal reliance on
     select(2),  threaded processes may be arbitrarily limited in the number
     of file descriptors that they can collectively have open.

OpenBSD 2.6                     August 17, 1998                              2

Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY
SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts
Institute of Technology, Free Software Foundation, FreeBSD Inc., and others.

(Corrections, notes, and links courtesy of RocketAware.com)

[Detailed Topics]

[Overview Topics]

RocketLink!--> Man page versions:

Rapid-Links: Search | About | Comments | Submit Path: RocketAware > man pages > pthreads.3/
RocketAware.com is a service of Mib Software
Copyright 1999, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments