Multithreaded Programming Guide
  Cerca solo questo libro
Scarica il manuale in formato PDF

Index

Symbols

__errno108
__t_errno108
_r115
_REENTRANT108, 137
.....managing incompatibilities121

A

Ada93
adb110
adding
.....to LWP pool30
.....signals to mask17
aio_errno98
AIO_INPROGRESS98
aio_result_t97, 98
aiocancel(3)97, 98
aioread(3)97, 98
aiowait(3)98
aiowrite(3)97, 98
alarm9, 81
algorithms
.....faster with MT3
.....parallel129
.....sequential129
alternate signal stacks9, 86
ANSI C111
application-level threads
.....Seeuser-level threads
architecture
.....MT system7
.....multiprocessor124
.....SPARC38, 126, 128
assert statement58, 118
assert(3X)146
asynchronous
.....event notification68
.....I/O96, 97, 98
.....semaphore use68
.....signals86 to 91
Async-Safe
.....category103
.....functions90, 105
.....and signal handlers93
atomic, defined43
automatic
.....arrays, problems110
.....local variable115
.....LWP number adjustments84
.....stack allocation28
.....termination, daemon threads19

B

barrier synchronization129
benefits, multithreading1, 3
binary semaphores67
binding
.....See also bound threads
.....reasons to bind9, 85, 123, 124
.....threads to LWPs30
.....values to keys22, 23
bound threads6, 9, 10, 85
.....See alsobinding
.....alternate signal stacks86
.....concurrency123
.....defined2
.....mixing with unbound threads10
.....no LWP caching123
.....priority83
.....realtime timer and alarm81
.....reasons to bind9, 85, 123, 124
.....scheduling class83
.....andTHR_BOUND13
.....and timers82

C

C++111
cache, defined125
caching
.....not for bound thread LWPs123
.....threads data structure122
changing the signal mask16
coarse-grained locking117
code lock117, 118
code monitor117, 119
completion semantics92
concurrency2, 117, 121, 122, 123
.....excessive121
.....level30
.....unbound threads33
cond_broadcast(3T)50, 54, 56, 87
.....example54
cond_destroy(3T)55
cond_init(3T)49, 75
cond_signal(3T)50, 51, 56, 57, 87
......example52
cond_timedwait(3T)52, 53, 94
......example53
cond_wait(3T)50, 56, 57, 87, 94, 95
......example52
condition variables37, 48 to 59, 94
coroutine linkage8
counting semaphores Seesemaphores
creating
......new signal mask (example)31
......stacks12, 28, 29
......threads12 to 14, 27 to 31, 123
......thread-specific keys22, 23, 24, 27
critical section127
custom stack28, 29, 32

D

-D _REENTRANT108, 121
daemon threads19, 30
data
......global22
......local22
......lock117, 118
......profile82
......races101
......shared6, 127
......thread specific,Seethread-specificdata
dbx111
deadlock109, 119
debugging10, 109 to 112
......adb110
......dbx111
definitions of MT terms2
deleting signals from mask17
destructor function23, 27
detached threads18, 21, 30
Dijkstra, E. W.66

E

EAGAIN13, 23, 31, 34
EBUSY63, 64, 71
EDEADLK20
EFAULT17, 39 to 42, 50 to 52, 53, 55, 61, 62 to 65, 69 to 72
EINTR51, 53, 71, 80, 86, 87, 94, 95
EINVAL14, 16, 17, 23, 24, 31, 34, 35, 39 to 42, 50, 53, 61 to 65, 69 to 72
ENOMEM14, 23, 31
errno25, 108, 114
errno.h107
error checking16
ESRCH15, 16, 20, 34, 35
ETIME53
event notification68
examining the signal mask16
exec(2)79, 80, 81
execution resources33, 122
exit(2)18, 30, 81

F

finding
.....minimum stack size32
.....thread concurrency level33
.....thread priority34
fine-grained locking117
flockfile(3S)99
fork cleanup handler80
fork(2)50, 53, 79, 80, 81
fork1(2)79, 80, 81
FORTRAN111
funlockfile(3S)99

G

getc(3S)99
getc_unlocked(3S)99
gethostbyname(3N)115
gethostbyname_r(3N)115
getrusage(3B)82
global
......data117
......memory109
......state116
......thread scheduling9
......variables24, 25, 109, 113, 114

H

heap,malloc(3C) storage from21
hreads11

I

I/O
......asynchronous96, 97
......nonsequential98
......standard99
......synchronous96
inheriting priority12
interrupt86
interval timer81, 82, 123
invariants58, 118

J

joining threads18, 19

K

kernel context switching6
kernel-level threads6
keys
......bind value to key23
......destructor function23
......get specific key24
......global into private26
......storing value of22, 24
......for TSD22
kill(2)86, 89

L

-lc108, 109
ld108, 109
libC106
libc105, 107, 108, 109
libdl_stubs105
libintl105, 107
libm105, 107
libmalloc105, 107
libmapmalloc105, 107
libnsl105, 107, 108
library
.....C routines113
.....threads7, ?? to 77, 107
.....threads<$startrange.>11
libresolv106
libsocket106
libthread5, 7, 11, 107, 108
libw106, 107
libX11106
lightweight processes8, 9, 82 to 85, 89
.....adding an LWP30
.....creation9
.....debugging110
.....defined2
.....independence9
.....multiplexing8
.....no time-slicing of threads36
.....not supported8
.....profile state82
.....shortage85
.....special capabilities9
.....in SunOS 4.08
.....and system calls10
.....and thread scheduling35
limits, resources82
linking107
local variable109, 115
lock hierarchy120
lock_lint44
locking
.....See alsolocks
.....coarse grained117
.....code117
.....data117
.....fine-grained117
......guidelines120
......invariants118
locks
......See alsolocking
......mutual exclusion37 to 48, 80, 94
......readers/writer37, 60 to 66
longjmp(3C)82, 93
lseek(2)99
-lthread108, 109
LWPs,Seelightweight processes

M

main()121
maintaining thread-specific data22
malloc(3C)21
MAP_NORESERVE28
MAP_SHARED81
memory
......global109
......ordering, relaxed127
......strongly ordered126
mmap(2)28, 39, 81
monitor, code117, 119
mprotect(2)29
MT-Safe libraries105
multiple-readers, single-writer locks60 to 66, 77
multiplexing with LWPs8
multiprocessors124 to 129
multithreading
......See alsothreads
......benefits1
......defined2
mutex Seemutual exclusion locks
mutex_destroy(3T)42
mutex_init(3T)39, 75
mutex_lock(3T)40
......example43, 45, 47, 48
mutex_trylock(3T)40, 45, 120
mutex_unlock(3T)41
......example43, 45, 47, 48
mutual exclusion locks37 to 48, 80, 94

N

nametoaddr106
NDEBUG58
netdir105
netselect105
nice(2)83, 84
nondetached threads18 to 21
nonsequential I/O98
nsswitch106
null
.....procedures108
.....threads29, 32

P

P operation67
parallel
.....algorithms129
.....array computation9
parallelism, defined2
Pascal111
PC6
PC_GETCID83
PC_GETCLINFO83
PC_GETPARMS83
PC_SETPARMS83
performance times4
per-process signal handler86
per-thread signal handler86
Peterson's Algorithm127
PL/188
portability38
POSIX 1003.4a10, 80
pread(2)97, 99
printf problem115
printf(3S)93
priocntl(2)36, 83, 84
priority6, 9, 82, 83, 84
......finding for a thread34
......inheritance12, 34
......andpriocntl(2)36
......range35
......and scheduling34, 35
......setting for a thread35
process
......terminating18
......traditional UNIX1
producer/consumer problem75, 126
profil(2)82
profile82
profiling an LWP82
programmer-allocated stack28, 29, 32, 109
prolagen67
pthread_atfork()80
putc(3S)99
putc_unlocked(3S)99
pwrite(2)97, 99

R

raw device133
read(2)98, 99
readers/writer locks37, 60 to 66, 77
realtime10
......schedule threads globally9
......scheduling82, 84
red zone28, 29
reentrant117
......See also_REENTRANT
......described116
......functions103, 104
......strategies for making117
register state6
relaxed memory ordering127
remote procedure call SeeRPC
replacing signal mask17
RPC4, 105, 122
RT,Seerealtime
rw_rdlock(3T)62
rw_tryrdlock(3T)62
rw_trywrlock(3T)64
rw_unlock(3T)64
rw_wrlock(3T)63
rwlock_destroy(3T)65
rwlock_init(3T)61, 75

S

SA_RESTART95
safety, threads interfaces101 to 106
scheduling
.....class82 to 85
.....compute-bound threads33
.....globally for threads9
.....libthread routines35
.....preemptive35
.....priorities34
.....realtime82, 84
.....system class82
.....timeshare82, 83
sema_destroy(3T)72
sema_init(3T)69, 75
.....example73
sema_post(3T)67, 70, 105
.....example74
sema_trywait(3T)67, 71
sema_wait(3T)70
.....example74
semaphores37, 66 to 77
.....binary67
.....counting, defined2
sending signal to thread16
sequential algorithms129
setjmp(3C)82, 92, 93
setting
.....thread concurrency level33
.....thread priority34
shared data6, 117
shared-memory multiprocessor126
SIG_BLOCK17
SIG_DFL86
SIG_IGN86
SIG_SETMASK17
SIG_UNBLOCK17
sigaction(2)86, 87, 95
sigaltstack(2)86
SIGFPE87, 92
SIGILL87
SIGINT31, 87, 91, 95
SIGIO87, 98
siglongjmp(3C)92, 93
signal(2)86
signal(5)86
signal.h16
signals
......access mask16
......add to mask17
......asynchronous86 to 91
......create new mask (example)31
......delete from mask17
......handler86, 90
......inheritance12
......masks6
......pending12
......replace current mask17
......send to thread16
......SIG_BLOCK17
......SIG_SETMASK17
......SIG_UNBLOCK17
......SIGSEGV28
......stack9, 86
......unmasked and caught94
sigprocmask(2)89
SIGPROF82
SIGSEGV28, 87
sigsend(2)86
sigsetjmp(3C)93
sigtimedwait(2)90
SIGVTALRM82
sigwait(2)89, 90, 91, 93
SIGWAITING85
single-threaded
......assumptions113
......code38
......defined2
single-threaded(continued)
.....processes81
size of stack12, 27, 29, 32
stack122, 123
.....address12, 27
.....boundaries28
.....creation12
.....custom29
.....deallocation29
.....minimum size29, 32
.....overflows28
.....parameters21
.....pointer6
.....programmer-allocated27, 28, 29, 109
.....reclaiming19
.....red zone28, 29
.....returning a pointer to103
.....size12, 27, 29, 32
stack_base12, 27
stack_size12, 27
standard I/O99
standards10, 80
start_routine13, 29
static storage108, 113
stdio25, 108
store buffer128
storing thread key value22, 24
streaming a tape drive97
strongly ordered memory126
suspending a new thread30, 36
swap space28
synchronization objects37 to 77
.....condition variables37, 48 to 59
.....mutex locks37 to 48
.....readers/writer locks60 to 66
.....semaphores37, 66 to 76
synchronous I/O96, 97
system calls
.....handling errors114
.....and LWPs10
system scheduling class82

T

tape drive, streaming97
terminating
......a process18
......threads20
terms, defined2
THR_BOUND30
thr_continue(3T)30, 36
thr_create(3T)12, 24, 27, 29, 36, 85
THR_DAEMON19, 30
THR_DETACHED18, 30
thr_exit(3T)17, 18, 20, 30
thr_getconcurrency(3T)33
thr_getprio(3T)34, 35
thr_getspecific(3T)22, 24, 25, 27
thr_join(3T)19, 20, 28, 96
thr_keycreate(3T)22, 26, 27
......example26
thr_kill(3T)89, 105
thr_min_stack(3T)27, 29
THR_NEW_LWP30, 34, 85, 123
thr_self(3T)14
thr_setconcurrency(3T)30, 33, 85, 122, 124
thr_setprio(3T)35, 83, 85
thr_setspecific(3T)22, 23, 27
......example26
thr_sigsetmask(3T)31, 89, 105
thr_suspend(3T)15, 36
THR_SUSPENDED13, 30, 36
thr_yield(3T)14, 36, 120
thread.h107
thread-directed signal90
thread-private storage6
threads
......binding Seebound threads
......bound Seebound threads
......compute-bound33
......concurrency Seeconcurrency
......creating12 to 14, 27 to 31, 123
......daemon19, 30
threads(continued)
.....defined2
.....detached18, 21, 30
.....exit codes20
.....identifiers14, 18 to 20, 30, 31
.....initial18
.....joining18, 19
.....kernel-level6
.....keys Seekeys
.....library7, 11 to 77, 107
.....lightweight processes Seelightweightprocesses
.....maintaining TSD22
.....nondetached18 to 21
.....null29, 32
.....priority Seepriority
.....private data22
.....safety101 to 106
.....signals Seesignals
.....stacks Seestack103
.....suspending30, 36
.....synchronizing37 to 77
.....terminating17 to 20
.....thread-specific data Seethread-specific data114
.....unbound Seeunbound threads
.....user-level2, 5, 6
thread-specific data22 to 26
.....global24, 25, 27
.....global into private25
.....maintaining22
.....new storage class114
.....private24
time slicing84
time-out53
timer9, 81
times, performance4
timeshare scheduling class82, 83, 84
tiuser.h108
TLI105, 108
tools
.....adb110
.....dbx111
.....debugger10, 111
tools(continued)
......lock_lint44
......truss10
total store order128
trap86
truss10
TS,Seetimeshare scheduling class
TSD,Seethread-specific data

U

unbound threads82
......alternate signal stacks86
......caching122
......concurrency33, 123
......defined2, 9
......disadvantage9
......floating9
......mixing with bound threads10
......priorities34, 82
......reasons not to bind122, 123
......and scheduling82, 84, 85
......andTHR_NEW_LWP13
......andthr_setconcurrency(3T)122
......andthr_setprio(3T)83, 85
UNIX1, 5, 10, 87, 96, 98, 114
user space6
user-level threads2, 5, 6
USYNC_PROCESS39, 49, 61, 69, 75, 123
USYNC_THREAD39, 49, 61, 69, 75

V

V operation67
variables
......condition37, 48 to 66, 77
......global109, 114
......local109
......primitive38
verhogen67
vfork(2)81

W

write(2)98, 99

X

XDR105