OSDN Git Service

Update release for LDP 3.67
[linuxjm/LDP_man-pages.git] / release / man2 / sched_setscheduler.2
1 .\" Copyright (C) 2014 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 .\"
28 .\" This file was generated with po4a. Translate the source file.
29 .\"
30 .\"*******************************************************************
31 .\"
32 .\" Japanese Version Copyright (c) 1996 Akira Yoshiyama
33 .\"         all rights reserved.
34 .\" Translated Thu Jul 11 01:42:52 JST 1996
35 .\"         by Akira Yoshiyama <yosshy@jedi.seg.kobe-u.ac.jp>
36 .\" Modified Sun Nov 21 19:36:18 JST 1999
37 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
38 .\" Updated Wed Jan  1 JST 2003 by Kentaro Shirakata <argrath@ub32.org>
39 .\" Updated 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
40 .\" Updated & Modified 2005-10-10, Akihiro MOTOKI
41 .\" Updated 2006-04-16, Akihiro MOTOKI, Catch up to LDP v2.28
42 .\" Updated 2007-10-13, Akihiro MOTOKI, LDP v2.65
43 .\" Updated 2008-08-13, Akihiro MOTOKI, LDP v3.05
44 .\" Updated 2012-06-04, Akihiro MOTOKI <amotoki@gmail.com>
45 .\" Updated 2013-05-01, Akihiro MOTOKI <amotoki@gmail.com>
46 .\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
47 .\"
48 .TH SCHED_SETSCHEDULER 2 2014\-05\-21 Linux "Linux Programmer's Manual"
49 .SH 名前
50 sched_setscheduler, sched_getscheduler \- スケジューリング・ポリシーとパラメータを設定/取得する
51 .SH 書式
52 .nf
53 \fB#include <sched.h>\fP
54 .sp
55 \fBint sched_setscheduler(pid_t \fP\fIpid\fP\fB, int \fP\fIpolicy\fP\fB,\fP
56 .br
57 \fB                       const struct sched_param *\fP\fIparam\fP\fB);\fP
58 .sp
59 \fBint sched_getscheduler(pid_t \fP\fIpid\fP\fB);\fP
60 .sp
61 .fi
62 .SH 説明
63 The \fBsched_setscheduler\fP()  system call sets both the scheduling policy and
64 parameters for the thread whose ID is specified in \fIpid\fP.  If \fIpid\fP equals
65 zero, the scheduling policy and parameters of the calling thread will be
66 set.
67
68 The scheduling parameters are specified in the \fIparam\fP argument, which is a
69 pointer to a structure of the following form:
70
71 .nf
72 .in +4n
73 struct sched_param {
74     ...
75     int sched_priority;
76     ...
77 };
78 .in
79 .fi
80
81 In the current implementation, the structure contains only one field,
82 \fIsched_priority\fP.  The interpretation of \fIparam\fP depends on the selected
83 policy.
84
85 Currently, Linux supports the following "normal" (i.e., non\-real\-time)
86 scheduling policies as values that may be specified in \fIpolicy\fP:
87 .TP  14
88 \fBSCHED_OTHER\fP
89 .\" In the 2.6 kernel sources, SCHED_OTHER is actually called
90 .\" SCHED_NORMAL.
91 標準の、ラウンドロビンによる時分割型のスケジューリング・ポリシー。
92 .TP 
93 \fBSCHED_BATCH\fP
94 「バッチ」形式でのプロセスの実行用。
95 .TP 
96 \fBSCHED_IDLE\fP
97 「非常に」低い優先度で動作するバックグラウンド・ジョブ用。
98 .PP
99 For each of the above policies, \fIparam\->sched_priority\fP must be 0.
100
101 Various "real\-time" policies are also supported, for special time\-critical
102 applications that need precise control over the way in which runnable
103 threads are selected for execution.  For the rules governing when a process
104 may use these policies, see \fBsched\fP(7).  The real\-time policies that may be
105 specified in \fIpolicy\fP are:
106 .TP  14
107 \fBSCHED_FIFO\fP
108 ファーストイン、ファーストアウト型のポリシー。
109 .TP 
110 \fBSCHED_RR\fP
111 ラウンドロビン型のポリシー。
112 .PP
113 For each of the above policies, \fIparam\->sched_priority\fP specifies a
114 scheduling priority for the thread.  This is a number in the range returned
115 by calling \fBsched_get_priority_min\fP(2)  and \fBsched_get_priority_min\fP(2)
116 with the specified \fIpolicy\fP.  On Linux, these system calls return,
117 respectively, 1 and 99.
118
119 Since Linux 2.6.32, the \fBSCHED_RESET_ON_FORK\fP flag can be ORed in \fIpolicy\fP
120 when calling \fBsched_setscheduler\fP().  As a result of including this flag,
121 children created by \fBfork\fP(2)  do not inherit privileged scheduling
122 policies.  See \fBsched\fP(7)  for details.
123
124 \fBsched_getscheduler\fP()  returns the current scheduling policy of the thread
125 identified by \fIpid\fP.  If \fIpid\fP equals zero, the policy of the calling
126 thread will be retrieved.
127 .SH 返り値
128 成功した場合、 \fBsched_setscheduler\fP()  は 0 を返す。 成功した場合、 \fBsched_getscheduler\fP()
129 は現在のそのスレッドのポリシー (非負の整数) を返す。 エラーの場合、 どちらのコールも \-1 を返し、 \fIerrno\fP が適切に設定される。
130 .SH エラー
131 .TP 
132 \fBEINVAL\fP
133 Invalid arguments: \fIpid\fP is negative or \fIparam\fP is NULL.
134 .TP 
135 \fBEINVAL\fP
136 (\fBsched_setscheduler\fP()) \fIpolicy\fP が認識できるポリシーではない。
137 .TP 
138 \fBEINVAL\fP
139 (\fBsched_setscheduler\fP()) 引き数 \fIparam\fP が指定された \fIpolicy\fP では意味を持たない。
140 .TP 
141 \fBEPERM\fP
142 呼び出したスレッドが適切な特権を持っていない。
143 .TP 
144 \fBESRCH\fP
145 ID が \fIpid\fP のスレッドが見つからなかった。
146 .SH 準拠
147 POSIX.1\-2001 (但し、下記のバグの節も参照)。 \fBSCHED_BATCH\fP と \fBSCHED_IDLE\fP ポリシーは Linux
148 固有である。
149 .SH 注意
150 Further details of the semantics of all of the above "normal" and
151 "real\-time" scheduling policies can be found in \fBsched\fP(7).
152
153 POSIX システムでは \fI<unistd.h>\fP に \fB_POSIX_PRIORITY_SCHEDULING\fP
154 が定義されている場合にのみ \fBsched_setscheduler\fP()  と \fBsched_getscheduler\fP()  が使用できる。
155
156 POSIX.1 は、非特権スレッドが \fBsched_setscheduler\fP()  を呼び出すために必要な権限の詳細を規定しておらず、
157 詳細はシステムにより異なる。 例えば、Solaris 7 のマニュアルページでは、 呼び出し元の実ユーザ ID または実効ユーザ ID が
158 設定対象の実ユーザ ID か保存 (save) set\-user\-ID と 一致していなければならない、となっている。
159 .PP
160 Linux では、 スケジューリングポリシーとスケジューリングパラメータは、 実際にはスレッド単位の属性である。 \fBgettid\fP(2)
161 の呼び出しの返り値をこのシステムコールの \fIpid\fP 引き数として渡すことができる。 \fIpid\fP に 0 を指定すると、
162 呼び出し元のスレッドの属性が設定される。 \fBgetpid\fP(2) コールからの返り値を \fIpid\fP に指定すると、
163 スレッドグループのメインスレッドの属性が設定される (POSIX スレッド API を使用している場合は、 \fBsched_*\fP(2)
164 システムコールの代わりに \fBpthread_setschedparam\fP(3), \fBpthread_getschedparam\fP(3), and
165 \fBpthread_setschedprio\fP(3) を使用すること)。
166 .SH バグ
167 POSIX では、成功時に \fBsched_setscheduler\fP()  は直前のスケジューリング・ポリシーを返すべきとされている。 Linux の
168 \fBsched_setscheduler\fP()  はこの要求仕様に準拠しておらず、 成功時には常に 0 を返す。
169 .SH 関連項目
170 .ad l
171 .nh
172 \fBnice\fP(2), \fBsched_get_priority_max\fP(2), \fBsched_get_priority_min\fP(2),
173 \fBsched_getaffinity\fP(2), \fBsched_getattr\fP(2), \fBsched_getparam\fP(2),
174 \fBsched_rr_get_interval\fP(2), \fBsched_setaffinity\fP(2), \fBsched_setattr\fP(2),
175 \fBsched_setparam\fP(2), \fBsched_yield\fP(2), \fBsetpriority\fP(2),
176 \fBcapabilities\fP(7), \fBcpuset\fP(7), \fBsched\fP(7)
177 .ad
178 .SH この文書について
179 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
180 である。プロジェクトの説明とバグ報告に関する情報は
181 http://www.kernel.org/doc/man\-pages/ に書かれている。