summaryrefslogtreecommitdiff
path: root/usr/src/man/man5/threads.5
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/man/man5/threads.5')
-rw-r--r--usr/src/man/man5/threads.5335
1 files changed, 147 insertions, 188 deletions
diff --git a/usr/src/man/man5/threads.5 b/usr/src/man/man5/threads.5
index 9770404d2e..d60037ca9a 100644
--- a/usr/src/man/man5/threads.5
+++ b/usr/src/man/man5/threads.5
@@ -3,7 +3,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH threads 5 "11 Nov 2008" "SunOS 5.11" "Standards, Environments, and Macros"
+.TH THREADS 5 "Nov 11, 2008"
.SH NAME
threads, pthreads \- POSIX pthreads and Solaris threads concepts
.SH SYNOPSIS
@@ -15,7 +15,7 @@ cc -mt [ \fIflag\fR... ] \fIfile\fR... [ -lrt \fIlibrary\fR... ]
.LP
.nf
-#include <pthread.h>
+#include <pthread.h>
.fi
.SS "Solaris"
@@ -110,31 +110,29 @@ Solaris threads, a hyphen (\fB-\fR) appears in the column.
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_create()\fR\fBthr_create()\fR
-\fBpthread_attr_init()\fR\fB-\fR
-\fBpthread_attr_setdetachstate()\fR\fB-\fR
-\fBpthread_attr_getdetachstate()\fR\fB-\fR
-\fBpthread_attr_setinheritsched()\fR\fB-\fR
-\fBpthread_attr_getinheritsched()\fR\fB-\fR
-\fBpthread_attr_setschedparam()\fR\fB-\fR
-\fBpthread_attr_getschedparam()\fR\fB-\fR
-\fBpthread_attr_setschedpolicy()\fR\fB-\fR
-\fBpthread_attr_getschedpolicy()\fR\fB-\fR
-\fBpthread_attr_setscope()\fR\fB-\fR
-\fBpthread_attr_getscope()\fR\fB-\fR
-\fBpthread_attr_setstackaddr()\fR\fB-\fR
-\fBpthread_attr_getstackaddr()\fR\fB-\fR
-\fBpthread_attr_setstacksize()\fR\fB-\fR
-\fBpthread_attr_getstacksize()\fR\fB-\fR
-\fBpthread_attr_getguardsize()\fR\fB-\fR
-\fBpthread_attr_setguardsize()\fR\fB-\fR
-\fBpthread_attr_destroy()\fR\fB-\fR
-\fB-\fR\fBthr_min_stack()\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_create()\fR \fBthr_create()\fR
+\fBpthread_attr_init()\fR \fB-\fR
+\fBpthread_attr_setdetachstate()\fR \fB-\fR
+\fBpthread_attr_getdetachstate()\fR \fB-\fR
+\fBpthread_attr_setinheritsched()\fR \fB-\fR
+\fBpthread_attr_getinheritsched()\fR \fB-\fR
+\fBpthread_attr_setschedparam()\fR \fB-\fR
+\fBpthread_attr_getschedparam()\fR \fB-\fR
+\fBpthread_attr_setschedpolicy()\fR \fB-\fR
+\fBpthread_attr_getschedpolicy()\fR \fB-\fR
+\fBpthread_attr_setscope()\fR \fB-\fR
+\fBpthread_attr_getscope()\fR \fB-\fR
+\fBpthread_attr_setstackaddr()\fR \fB-\fR
+\fBpthread_attr_getstackaddr()\fR \fB-\fR
+\fBpthread_attr_setstacksize()\fR \fB-\fR
+\fBpthread_attr_getstacksize()\fR \fB-\fR
+\fBpthread_attr_getguardsize()\fR \fB-\fR
+\fBpthread_attr_setguardsize()\fR \fB-\fR
+\fBpthread_attr_destroy()\fR \fB-\fR
+\fB-\fR \fBthr_min_stack()\fR
.TE
.SS "Functions Related to Exit"
@@ -142,14 +140,12 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_exit()\fR\fBthr_exit()\fR
-\fBpthread_join()\fR\fBthr_join()\fR
-\fBpthread_detach()\fR\fB-\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_exit()\fR \fBthr_exit()\fR
+\fBpthread_join()\fR \fBthr_join()\fR
+\fBpthread_detach()\fR \fB-\fR
.TE
.SS "Functions Related to Thread Specific Data"
@@ -157,15 +153,13 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_key_create()\fR\fBthr_keycreate()\fR
-\fBpthread_setspecific()\fR\fBthr_setspecific()\fR
-\fBpthread_getspecific()\fR\fBthr_getspecific()\fR
-\fBpthread_key_delete()\fR\fB-\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_key_create()\fR \fBthr_keycreate()\fR
+\fBpthread_setspecific()\fR \fBthr_setspecific()\fR
+\fBpthread_getspecific()\fR \fBthr_getspecific()\fR
+\fBpthread_key_delete()\fR \fB-\fR
.TE
.SS "Functions Related to Signals"
@@ -173,13 +167,11 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_sigmask()\fR\fBthr_sigsetmask()\fR
-\fBpthread_kill()\fR\fBthr_kill()\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_sigmask()\fR \fBthr_sigsetmask()\fR
+\fBpthread_kill()\fR \fBthr_kill()\fR
.TE
.SS "Functions Related to IDs"
@@ -187,14 +179,12 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_self()\fR\fBthr_self()\fR
-\fBpthread_equal()\fR\fB-\fR
-\fB-\fR\fBthr_main()\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_self()\fR \fBthr_self()\fR
+\fBpthread_equal()\fR \fB-\fR
+\fB-\fR \fBthr_main()\fR
.TE
.SS "Functions Related to Scheduling"
@@ -202,19 +192,17 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fB-\fR\fBthr_yield()\fR
-\fB-\fR\fBthr_suspend()\fR
-\fB-\fR\fBthr_continue()\fR
-\fBpthread_setconcurrency()\fR\fBthr_setconcurrency()\fR
-\fBpthread_getconcurrency()\fR\fBthr_getconcurrency()\fR
-\fBpthread_setschedparam()\fR\fBthr_setprio()\fR
-\fBpthread_setschedprio()\fR\fBthr_setprio()\fR
-\fBpthread_getschedparam()\fR\fBthr_getprio()\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fB-\fR \fBthr_yield()\fR
+\fB-\fR \fBthr_suspend()\fR
+\fB-\fR \fBthr_continue()\fR
+\fBpthread_setconcurrency()\fR \fBthr_setconcurrency()\fR
+\fBpthread_getconcurrency()\fR \fBthr_getconcurrency()\fR
+\fBpthread_setschedparam()\fR \fBthr_setprio()\fR
+\fBpthread_setschedprio()\fR \fBthr_setprio()\fR
+\fBpthread_getschedparam()\fR \fBthr_getprio()\fR
.TE
.SS "Functions Related to Cancellation"
@@ -222,17 +210,15 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_cancel()\fR\fB-\fR
-\fBpthread_setcancelstate()\fR\fB-\fR
-\fBpthread_setcanceltype()\fR\fB-\fR
-\fBpthread_testcancel()\fR\fB-\fR
-\fBpthread_cleanup_pop()\fR\fB-\fR
-\fBpthread_cleanup_push()\fR\fB-\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_cancel()\fR \fB-\fR
+\fBpthread_setcancelstate()\fR \fB-\fR
+\fBpthread_setcanceltype()\fR \fB-\fR
+\fBpthread_testcancel()\fR \fB-\fR
+\fBpthread_cleanup_pop()\fR \fB-\fR
+\fBpthread_cleanup_push()\fR \fB-\fR
.TE
.SS "Functions Related to Mutexes"
@@ -240,30 +226,28 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(3.85i) lw(1.65i)
-lw(3.85i) lw(1.65i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_mutex_init()\fR\fBmutex_init()\fR
-\fBpthread_mutexattr_init()\fR\fB-\fR
-\fBpthread_mutexattr_setpshared()\fR\fB-\fR
-\fBpthread_mutexattr_getpshared()\fR\fB-\fR
-\fBpthread_mutexattr_setprotocol()\fR\fB-\fR
-\fBpthread_mutexattr_getprotocol()\fR\fB-\fR
-\fBpthread_mutexattr_setprioceiling()\fR\fB-\fR
-\fBpthread_mutexattr_getprioceiling()\fR\fB-\fR
-\fBpthread_mutexattr_settype()\fR\fB-\fR
-\fBpthread_mutexattr_gettype()\fR\fB-\fR
-\fBpthread_mutexattr_setrobust()\fR\fB-\fR
-\fBpthread_mutexattr_getrobust()\fR\fB-\fR
-\fBpthread_mutexattr_destroy()\fR\fB-\fR
-\fBpthread_mutex_setprioceiling()\fR\fB-\fR
-\fBpthread_mutex_getprioceiling()\fR\fB-\fR
-\fBpthread_mutex_lock()\fR\fBmutex_lock()\fR
-\fBpthread_mutex_trylock()\fR\fBmutex_trylock()\fR
-\fBpthread_mutex_unlock()\fR\fBmutex_unlock()\fR
-\fBpthread_mutex_destroy()\fR\fBmutex_destroy()\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_mutex_init()\fR \fBmutex_init()\fR
+\fBpthread_mutexattr_init()\fR \fB-\fR
+\fBpthread_mutexattr_setpshared()\fR \fB-\fR
+\fBpthread_mutexattr_getpshared()\fR \fB-\fR
+\fBpthread_mutexattr_setprotocol()\fR \fB-\fR
+\fBpthread_mutexattr_getprotocol()\fR \fB-\fR
+\fBpthread_mutexattr_setprioceiling()\fR \fB-\fR
+\fBpthread_mutexattr_getprioceiling()\fR \fB-\fR
+\fBpthread_mutexattr_settype()\fR \fB-\fR
+\fBpthread_mutexattr_gettype()\fR \fB-\fR
+\fBpthread_mutexattr_setrobust()\fR \fB-\fR
+\fBpthread_mutexattr_getrobust()\fR \fB-\fR
+\fBpthread_mutexattr_destroy()\fR \fB-\fR
+\fBpthread_mutex_setprioceiling()\fR \fB-\fR
+\fBpthread_mutex_getprioceiling()\fR \fB-\fR
+\fBpthread_mutex_lock()\fR \fBmutex_lock()\fR
+\fBpthread_mutex_trylock()\fR \fBmutex_trylock()\fR
+\fBpthread_mutex_unlock()\fR \fBmutex_unlock()\fR
+\fBpthread_mutex_destroy()\fR \fBmutex_destroy()\fR
.TE
.SS "Functions Related to Condition Variables"
@@ -271,21 +255,19 @@ lw(3.85i) lw(1.65i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_cond_init()\fR\fBcond_init()\fR
-\fBpthread_condattr_init()\fR\fB-\fR
-\fBpthread_condattr_setpshared()\fR\fB-\fR
-\fBpthread_condattr_getpshared()\fR\fB-\fR
-\fBpthread_condattr_destroy()\fR\fB-\fR
-\fBpthread_cond_wait()\fR\fBcond_wait()\fR
-\fBpthread_cond_timedwait()\fR\fBcond_timedwait()\fR
-\fBpthread_cond_signal()\fR\fBcond_signal()\fR
-\fBpthread_cond_broadcast()\fR\fBcond_broadcast()\fR
-\fBpthread_cond_destroy()\fR\fBcond_destroy()\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_cond_init()\fR \fBcond_init()\fR
+\fBpthread_condattr_init()\fR \fB-\fR
+\fBpthread_condattr_setpshared()\fR \fB-\fR
+\fBpthread_condattr_getpshared()\fR \fB-\fR
+\fBpthread_condattr_destroy()\fR \fB-\fR
+\fBpthread_cond_wait()\fR \fBcond_wait()\fR
+\fBpthread_cond_timedwait()\fR \fBcond_timedwait()\fR
+\fBpthread_cond_signal()\fR \fBcond_signal()\fR
+\fBpthread_cond_broadcast()\fR \fBcond_broadcast()\fR
+\fBpthread_cond_destroy()\fR \fBcond_destroy()\fR
.TE
.SS "Functions Related to Reader/Writer Locking"
@@ -293,22 +275,20 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_rwlock_init()\fR\fBrwlock_init()\fR
-\fBpthread_rwlock_rdlock()\fR\fBrw_rdlock()\fR
-\fBpthread_rwlock_tryrdlock()\fR\fBrw_tryrdlock()\fR
-\fBpthread_rwlock_wrlock()\fR\fBrw_wrlock()\fR
-\fBpthread_rwlock_trywrlock()\fR\fBrw_trywrlock()\fR
-\fBpthread_rwlock_unlock()\fR\fBrw_unlock()\fR
-\fBpthread_rwlock_destroy()\fR\fBrwlock_destroy()\fR
-\fBpthread_rwlockattr_init()\fR\fB-\fR
-\fBpthread_rwlockattr_destroy()\fR\fB-\fR
-\fBpthread_rwlockattr_getpshared()\fR\fB-\fR
-\fBpthread_rwlockattr_setpshared()\fR\fB-\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_rwlock_init()\fR \fBrwlock_init()\fR
+\fBpthread_rwlock_rdlock()\fR \fBrw_rdlock()\fR
+\fBpthread_rwlock_tryrdlock()\fR \fBrw_tryrdlock()\fR
+\fBpthread_rwlock_wrlock()\fR \fBrw_wrlock()\fR
+\fBpthread_rwlock_trywrlock()\fR \fBrw_trywrlock()\fR
+\fBpthread_rwlock_unlock()\fR \fBrw_unlock()\fR
+\fBpthread_rwlock_destroy()\fR \fBrwlock_destroy()\fR
+\fBpthread_rwlockattr_init()\fR \fB-\fR
+\fBpthread_rwlockattr_destroy()\fR \fB-\fR
+\fBpthread_rwlockattr_getpshared()\fR \fB-\fR
+\fBpthread_rwlockattr_setpshared()\fR \fB-\fR
.TE
.SS "Functions Related to Semaphores"
@@ -316,20 +296,18 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBsem_init()\fR\fBsema_init()\fR
-\fBsem_open()\fR\fB-\fR
-\fBsem_close()\fR\fB-\fR
-\fBsem_wait()\fR\fBsema_wait()\fR
-\fBsem_trywait()\fR\fBsema_trywait()\fR
-\fBsem_post()\fR\fBsema_post()\fR
-\fBsem_getvalue()\fR\fB-\fR
-\fBsem_unlink()\fR\fB-\fR
-\fBsem_destroy()\fR\fBsema_destroy()\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBsem_init()\fR \fBsema_init()\fR
+\fBsem_open()\fR \fB-\fR
+\fBsem_close()\fR \fB-\fR
+\fBsem_wait()\fR \fBsema_wait()\fR
+\fBsem_trywait()\fR \fBsema_trywait()\fR
+\fBsem_post()\fR \fBsema_post()\fR
+\fBsem_getvalue()\fR \fB-\fR
+\fBsem_unlink()\fR \fB-\fR
+\fBsem_destroy()\fR \fBsema_destroy()\fR
.TE
.SS "Functions Related to fork(\|) Clean Up"
@@ -337,12 +315,10 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_atfork()\fR\fB-\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_atfork()\fR \fB-\fR
.TE
.SS "Functions Related to Limits"
@@ -350,12 +326,10 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fBpthread_once()\fR\fB-\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fBpthread_once()\fR \fB-\fR
.TE
.SS "Functions Related to Debugging"
@@ -363,12 +337,10 @@ lw(2.75i) lw(2.75i)
.sp
.TS
-tab();
-lw(2.75i) lw(2.75i)
-lw(2.75i) lw(2.75i)
-.
-\fBPOSIX\fR\fBSolaris\fR
-\fB-\fR\fBthr_stksegment()\fR
+l l
+l l .
+\fBPOSIX\fR \fBSolaris\fR
+\fB-\fR \fBthr_stksegment()\fR
.TE
.SH LOCKING
@@ -403,24 +375,20 @@ mutexes throughout the process, the application should call
Solaris supports the following three POSIX scheduling policies:
.sp
.ne 2
-.mk
.na
\fB\fBSCHED_OTHER\fR\fR
.ad
.RS 15n
-.rt
Traditional Timesharing scheduling policy. It is based on the timesharing (TS)
scheduling class.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBSCHED_FIFO\fR\fR
.ad
.RS 15n
-.rt
First-In-First-Out scheduling policy. Threads scheduled to this policy, if not
preempted by a higher priority, will proceed until completion. Such threads are
in real-time (RT) scheduling class. The calling process must have a effective
@@ -429,12 +397,10 @@ user \fBID\fR of \fB0\fR.
.sp
.ne 2
-.mk
.na
\fB\fBSCHED_RR\fR\fR
.ad
.RS 15n
-.rt
Round-Robin scheduling policy. Threads scheduled to this policy, if not
preempted by a higher priority, will execute for a time period determined by
the system. Such threads are in real-time (RT) scheduling class and the calling
@@ -447,36 +413,30 @@ In addition to the POSIX-specified scheduling policies above, Solaris also
supports these scheduling policies:
.sp
.ne 2
-.mk
.na
\fB\fBSCHED_IA\fR\fR
.ad
.RS 13n
-.rt
Threads are scheduled according to the Inter-Active Class (IA) policy as
described in \fBpriocntl\fR(2).
.RE
.sp
.ne 2
-.mk
.na
\fB\fBSCHED_FSS\fR\fR
.ad
.RS 13n
-.rt
Threads are scheduled according to the Fair-Share Class (FSS) policy as
described in \fBpriocntl\fR(2).
.RE
.sp
.ne 2
-.mk
.na
\fB\fBSCHED_FX\fR\fR
.ad
.RS 13n
-.rt
Threads are scheduled according to the Fixed-Priority Class (FX) policy as
described in \fBpriocntl\fR(2).
.RE
@@ -506,13 +466,12 @@ See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.TS
-tab() box;
-cw(2.75i) |cw(2.75i)
-lw(2.75i) |lw(2.75i)
-.
-ATTRIBUTE TYPEATTRIBUTE VALUE
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
_
-MT-LevelMT-Safe, Fork 1-Safe
+MT-Level MT-Safe, Fork 1-Safe
.TE
.SH SEE ALSO