OSDN Git Service

b8f5c625fc1962f283f74209e2c8f9991c117241
[linuxjm/LDP_man-pages.git] / draft / man3 / pthread_setconcurrency.3
1 .\" Copyright (c) 2009 Michael Kerrisk, <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\"*******************************************************************
26 .\"
27 .\" This file was generated with po4a. Translate the source file.
28 .\"
29 .\"*******************************************************************
30 .TH PTHREAD_SETCONCURRENCY 3 2009\-04\-10 Linux "Linux Programmer's Manual"
31 .SH 名前
32 pthread_setconcurrency, pthread_getconcurrency \- 並列処理レベルの設定/取得を行う
33 .SH 書式
34 .nf
35 \fB#include <pthread.h>\fP
36
37 \fBint pthread_setconcurrency(int \fP\fInew_level\fP\fB);\fP
38 \fBint pthread_getconcurrency(void);\fP
39 .sp
40 \fI\-pthread\fP でコンパイルしてリンクする。
41 .fi
42 .SH 説明
43 \fBpthread_setconcurrency\fP() 関数は、アプリケーションが希望する
44 並列処理レベル (concurrency level) をスレッド実装に通知する。
45 希望する並列処理レベルは \fInew_level\fP で指定する。
46 スレッド実装はこの情報をヒントとしてのみ利用する。
47 POSIX.1 では、 \fBpthread_setconcurrency\fP() の呼び出した結果、
48 どのような並列度になるべきかは規定されていない。
49
50 \fInew_level\fP に 0 を指定すると、スレッド実装は並列処理レベルを
51 実装側で適切とみなしたレベルに設定するようになる。
52
53 \fBpthread_getconcurrency\fP() は、このプロセスの concurrency level
54 の現在値を返す。
55 .SH 返り値
56 成功すると、 \fBpthread_setconcurrency\fP() は 0 を返す。
57 エラーの場合、 0 以外のエラー番号を返す。
58
59 \fBpthread_getconcurrency\fP() は常に成功し、最後の
60 \fBpthread_getconcurrency\fP() の呼び出しで設定された
61 concurrency level を返す。 \fBpthread_getconcurrency\fP() が
62 それまでに一度も呼び出されていない場合は 0 が返る。
63 .SH エラー
64 \fBpthread_setconcurrency\fP() は以下のエラーで失敗する場合がある。
65 .TP 
66 \fBEINVAL\fP
67 \fInew_level\fP が負である。
68 .PP
69 POSIX.1\-2001 には、エラー \fBEAGAIN\fP も記載されている
70 (「\fInew_level\fP に指定された値を適用すると、システムリソースが
71 超過してしまう」)。
72 .SH バージョン
73 これらの関数は glibc バージョン 2.1 以降で利用できる。
74 .SH 準拠
75 POSIX.1\-2001.
76 .SH 注意
77 デフォルトの concurrency level は 0 である。
78
79 並列処理レベルが意味を持つのは M:N スレッド実装の場合のみである。
80 M:N スレッド実装では、ある瞬間において、あるプロセスのユーザレベルスレッ
81 ドの集合のサブ集合が、そのサブ集合のサイズよりも少ない数のカーネルの
82 スケジューリング実体 (kernel\-scheduling entity) に結び付けられる。
83 並列処理レベルを設定すると、そのアプリケーションの効率的な実行に必要な
84 カーネルのスケジューリング実体の数のヒントを、アプリケーションはシステ
85 ムに伝えることができる。
86
87 LinuxThreads と NPTL のどちらも 1:1 スレッド実装であり、
88 並列処理レベルを設定しても何の意味もない。
89 言い換えると、 Linux では、これらの関数は、
90 他のシステムとの互換性のためだけに存在し、
91 プログラムの実行には何の影響も与えないということである。
92 .SH 関連項目
93 \fBpthread_attr_setscope\fP(3), \fBpthreads\fP(7)
94 .SH この文書について
95 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
96 である。プロジェクトの説明とバグ報告に関する情報は
97 http://www.kernel.org/doc/man\-pages/ に書かれている。