1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
|
'\" t
.\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Japanese Version Copyright (c) 2005 Akihiro MOTOKI all rights reserved.
.\" Translated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2006-04-15, Akihiro MOTOKI, Catch up to LDP v2.29
.\" Updated 2007-01-05, Akihiro MOTOKI, Catch up to LDP v2.43
.\"
.\"WORD: manager thread å
.\"WORD: thread group åɡ롼
.\"WORD: real-time signal ꥢ륿ॷʥ
.\"WORD: non-conformant ɸ
.\"WORD: alternate signal stack إʥ륹å
.\"
.TH PTHREADS 7 2005-06-07 "Linux" "Linux Programmer's Manual"
.SH ̾
pthreads \- POSIX å
.SH
POSIX.1 ϡ̤ POSIX åɤ Pthreads ȤΤ
åɡץߥΥե (ؿإåե)
ꤷƤ롣ĤΥץʣΥåɤĤȤǤ
ƤΥåɤƱץ¹Ԥ롣
ΥåɤƱ (ǡȥҡΰ) ͭ뤬
ƥåɤϼʬѤΥå (ưѿ) ġ
POSIX.1 ϥåɴ֤ǤɤΤ褦°ͭ뤫ˤĤƤƤ
(Ĥޤꡢ°ϥåñ̤ǤϤʤץΤǶ̤Ǥ):
.IP \- 3
ץ ID
.IP \- 3
ƥץ ID
.IP \- 3
ץ롼 ID ȥå ID
.IP \- 3
ü
.IP \- 3
桼 ID ȥ롼 ID
.IP \- 3
ץեǥץ
.IP \- 3
쥳ɤΥå
.RB ( fcntl (3)
)
.IP \- 3
ʥ
.IP \- 3
ե⡼ɺޥ
.RB ( umask (2))
.IP \- 3
ȡǥ쥯ȥ
.RB ( chdir (2))
ȥ롼ȡǥ쥯ȥ
.RB ( chroot (2))
.IP \- 3
Х롦
.RB ( setitimer (2))
POSIX
.RB ( timer_create (3))
.IP \- 3
nice
.RB ( setpriority (2))
.IP \- 3
.RB ( setrlimit (2))
.IP \- 3
CPU
.RB ( times (2))
ȥ
.RB ( getrusage (2))
ξη¬
.PP
åˤĤƤ⡢POSIX.1 ϤɤΤ褦°
ġΥåɤΩ˴뤫ꤷƤ:
.IP \- 3
å ID
.RB ( pthread_t
ǡ)
.IP \- 3
ʥޥ
.RB ( pthread_sigmask (3))
.IP \- 3
.I errno
ѿ
.IP \- 3
إʥ륹å
.RB ( sigaltstack (2))
.IP \- 3
ꥢ륿ࡦ塼Υݥꥷͥ
.RB ( sched_setscheduler (2)
.BR sched_setparam (2))
.PP
ʲ Linux ͭεǽ⥹åñ̤Ǥ:
.IP \- 3
ѥӥƥ
.RB ( capabilities (7)
)
.IP \- 3
CPU affinity ()
.RB ( sched_setaffinity (2))
.SS "Linux ǤΥѥ"
Linux ǤϡPthreads API Ѥץ
.I "cc \-pthread"
ǥѥ뤹٤Ǥ롣
.SS "POSIX åɤ Linux Ǥμ"
ޤǡ2ĤΥåɤμ Linux GNU C 饤֥ˤ
Ƥ
.TP
.B LinuxThreads
ǽ Pthreads μ
glibc 2.4 ʹߤϡμϤϤ䥵ݡȤƤʤ
.TP
.BR NPTL " (Native POSIX Threads Library)"
Pthreads μLinuxThreads ٤ȡ
NPTL POSIX.1 ͤؤνٹ礤⤯
¿Υåɤݤǽ⤤
NPTL glibc 2.3.2 ʹߤѲǽǤ롣
NPTL Ѥˤ Linux 2.6 ͥ˼Ƥ뵡ǽɬפǤ롣
.PP
ɤμ⤤ 1:1 ʤġΥåɤ
ͥΥ塼Τ˥ޥåԥ롣
ɤΥåɤμ Linux
.BR clone (2)
ƥॳѤƤ롣
NPTL ǤϡåƱδܵ (mutex åɤ join )
Linux
.BR futex (2)
ƥॳȤäƼƤ롣
.SS LinuxThreads
μ礭ħϰʲ̤Ǥ:
.IP \- 3
ᥤå (ǽΥå) ȥץब
.BR pthread_create (3)
Ȥäƺåɤ˲ä
μǤϡִ (manager)ץåɤ롣
åɤϥåɤκȽλ갷
(Υåɤä kill ȡ꤬뤳Ȥ)
.IP \- 3
μǤǥʥѤƤ롣
Linux 2.2 ʹߤǤϡꥢ륿ॷʥΤǽ 3ĤȤ롣
ΥͥǤ
.B SIGUSR1
.B SIGUSR2
Ȥ롣
ץꥱϡåɼѤƤ륷ʥ
ɤȤʤ褦ˤʤФʤʤ
.IP \- 3
åɴ֤ǥץ ID ͭʤ
(ºݤˤ LinuxThreads Υåɤ̾ϾͭץȤ
Ƥ뤬Ĥζ̤Υץ ID ͭƤϤʤ)
(åɤޤ) LinuxThreads åɤ
.BR ps (1)
Ȥ̤ΥץΤ褦˸롣
.PP
LinuxThreads μǤ POSIX.1 ͤæƤ
Ĥ롣ʲ˼褦:
.IP \- 3
.BR getpid (2)
ƤӽФȤˡå˰ۤʤ֤ͤ롣
.IP \- 3
ᥤåɰʳΥåɤ
.BR getppid (2)
ƤӽФȡåɤΥץ ID ֤롣
ϡΥåɤ
.BR getppid (2)
ƤˤϥᥤåɤǤ
.BR getppid (2)
Ʊ֤ͤ٤Ǥ롣
.IP \- 3
륹åɤ
.BR fork (2)
Ȥäƿҥץ硢
ɤΥåɤǤ⤳λҥץ
.BR wait (2)
Ǥ٤Ǥ롣ʤ顢μǤϻҥץ
åɤλҥץ
.BR wait (2)
Ǥ롣
.IP \- 3
륹åɤ
.BR execve (2)
ƤӽФ硢¾Υåɤƽλ (POSIX.1 λ̤)
ʤ顢ץ
.BR execve (2)
ƤåɤƱ PID ġ
ᥤåɤƱ PID Ĥ٤Ǥ롣
.IP \- 3
åɴ֤ǥ桼 ID ȥ롼 ID ͭʤ
ΤȤϡset-user-ID ץݤʻ֤ꡢ
ץꥱ
.BR seteuid (2)
ʤɤȤäƿѾ (credentials) ѹ
Pthreads ؿԤ븶Ȥʤ롣
.IP \- 3
åɴ֤Ƕ̤Υå ID ץ롼 ID ͭʤ
.IP \- 3
åɴ֤
.BR fcntl (2)
Ȥäƺ쥳ɡåͭʤ
.IP \- 3
.BR times (2)
.BR getrusage (2)
֤ץΤξǤʤåñ̤ξǤ롣
.IP \- 3
åɴ֤ǥޥեΥɥ
.RB ( semop (2)
) ͭʤ
.IP \- 3
åɴ֤ǥХ롦ޤͭʤ
.IP \- 3
åɤ϶̤ nice ͤͭʤ
.IP \- 3
POSXI.1 ǤϡΤȤƤΥץ륷ʥȡ
̤Υåɤ륷ʥ̤ƹͤƤ롣
POSIX.1 ˤȡץ줿ʥ (㤨
.BR kill (2)
Ȥä) ϡΥץ°åɤΤ
(arbitrarily) 줿ĤΥåɤˤ
ȤˤʤäƤ롣LinuxThreads ϥץ륷ʥ
ǰбƤ餺ʥΥåɤˤ뤳ȤǤ롣
.IP \- 3
åɤϤ줾ȼإʥ륹åġ
åɤإʥ륹å
Υåɤåɤ饳ԡ졢Τ
åɤϺǽϰĤإʥ륹åͭ롣
(ͤǤϡåɤإʥ륹åƤʤ
dzϤ٤ȤƤ롣
2ĤΥåɤͭƤإʥ륹åƱ
ʥνԤä硢ͽ¬ԲǽʥץΥ顼
롣)
.SS NPTL
NPTL ǤϡĤΥץƤΥåɤƱåɡ롼
°; åɡ롼פСƱ PID ͭ롣
NPTL ϴå (manager thread) Ѥʤ
NPTL ǥꥢ륿ॷʥΤǽ 2ĤֹѤƤꡢ
ΥʥϥץꥱǤϻѤǤʤ
NPTL ˤ POSIX.1 ˽ƤʤʤȤĤ:
.IP \- 3
åɤ϶̤ nice ͤͭʤ
.\" FIXME . bug report filed for NPTL nice non-conformance
.\" http://bugzilla.kernel.org/show_bug.cgi?id=6258
.PP
NPTL ɸΤĤϰΥͥǤΤȯ:
.IP \- 3
.BR times (2)
.BR getrusage (2)
֤ץΤξǤʤåñ̤ξǤ
(ͥ 2.6.9 ǽ줿)
.IP \- 3
åɴ֤ǥ¤ͭʤ (ͥ 2.6.10 ǽ줿)
.IP \- 3
åɴ֤ǥХ롦ޤͭʤ
(ͥ 2.6.12 ǽ줿)
.IP \- 3
ᥤåɤ
.BR setsid (2)
ȤäƿåϤ뤳ȤǤ
(ͥ 2.6.16 ǽ줿)
.IP \- 3
ᥤåɤ
.BR setpgid (2)
ȤäƤΥץץ롼סˤ뤳ȤǤ
(ͥ 2.6.16 ǽ줿)
.IP \- 3
åɤϤ줾ȼإʥ륹åġ
åɤإʥ륹å
Υåɤåɤ饳ԡ졢Τ
åɤϺǽϰĤإʥ륹åͭ
(ͥ 2.6.16 ǽ줿)
.PP
NPTL μǤϰʲˤĤƤդ뤳:
.IP \- 3
åΥΥեȡߥå
.RB ( setrlimit (2)
.B RLIMIT_STACK
)
.I unlimited
ʳͤꤵƤ硢եȡߥåȤͤ
åɤΥǥեȤΥåȤʤ롣
ͭˤ뤿ˤϡץ¹Ԥ˥ߥåͤ
ꤷƤʤФʤʤƤϡȤ߹ߥޥɤ
.I ulimit -s
(C Ǥ
.IR "limit stacksize" )
Ȥäꤹ롣
.SS "åɼȽ"
glibc 2.3.2 ʹߤǤϡ
.BR getconf (1)
ޥɤȤäơ
ƥΥåɼȽꤹ뤳ȤǤ롣
ʲ:
.nf
.in +4n
bash$ getconf GNU_LIBPTHREAD_VERSION
NPTL 2.3.4
.in
.fi
.PP
glibc ΥСǤϡʲΤ褦ʥޥɤ
ǥեȤΥåɼȽꤹ뤳ȤǤ롣
.nf
.in +4n
bash$ $( ldd /bin/ls | grep libc.so | awk '{print $3}' ) | \\
egrep \-i 'threads|ntpl'
Native POSIX Threads Library by Ulrich Drepper et al
.in
.fi
.SS "åɤμ: LD_ASSUME_KERNEL"
LinuxThreads NPTL ξݡȤƤ glibc
(glibc 2.3.\fIx\fP) 륷ƥǤϡ
.B LD_ASSUME_KERNEL
ĶѿȤȤǡưŪǥեȤ
륹åɼ뤳ȤǤ롣
ѿˤꡢưŪΥСΥͥ
ưƤȲꤹ褦˻ꤹ롣
NPTL ɬפȤ륵ݡȵǽƤʤͥС
ꤹ뤳ȤǡŪ LinuxThreads ȤȤǤ
(Τ褦ʤȤǤ⤢ꤽʾ̤ϡ
LinuxThreads ɸʿ˰¸ (줿) ץꥱ
ư)
ʲ:
.nf
.in +4n
bash$ $( LD_ASSUME_KERNEL=2.2.5 ldd /bin/ls | grep libc.so | \\
awk '{print $3}' ) | egrep \-i 'threads|ntpl'
linuxthreads-0.10 by Xavier Leroy
.in
.fi
.SH Ϣ
.BR clone (2),
.BR futex (2),
.BR gettid (2),
.BR futex (7),
Pthreads γƼޥ˥奢ڡ㤨:
.BR pthread_atfork (3),
.BR pthread_cleanup_push (3),
.BR pthread_cond_signal (3),
.BR pthread_cond_wait (3),
.BR pthread_create (3),
.BR pthread_detach (3),
.BR pthread_equal (3),
.BR pthread_exit (3),
.BR pthread_key_create (3),
.BR pthread_kill (3),
.BR pthread_mutex_lock (3),
.BR pthread_mutex_unlock (3),
.BR pthread_once (3),
.BR pthread_setcancelstate (3),
.BR pthread_setcanceltype (3),
.BR pthread_setspecific (3),
.BR pthread_sigmask (3),
.BR pthread_testcancel (3).
|