OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man2 / sched_setscheduler.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) Tom Bjorkholm, Markus Kuhn & David A. Wheeler 1996-1999
4 .\" and Copyright (C) 2007 Carsten Emde <Carsten.Emde@osadl.org>
5 .\" and Copyright (C) 2008 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\"
7 .\" This is free documentation; you can redistribute it and/or
8 .\" modify it under the terms of the GNU General Public License as
9 .\" published by the Free Software Foundation; either version 2 of
10 .\" the License, or (at your option) any later version.
11 .\"
12 .\" The GNU General Public License's references to "object code"
13 .\" and "executables" are to be interpreted as the output of any
14 .\" document formatting or typesetting system, including
15 .\" intermediate and printed output.
16 .\"
17 .\" This manual is distributed in the hope that it will be useful,
18 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
19 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 .\" GNU General Public License for more details.
21 .\"
22 .\" You should have received a copy of the GNU General Public
23 .\" License along with this manual; if not, write to the Free
24 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
25 .\" USA.
26 .\"
27 .\" 1996-04-01 Tom Bjorkholm <tomb@mydata.se>
28 .\"            First version written
29 .\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
30 .\"            revision
31 .\" 1999-08-18 David A. Wheeler <dwheeler@ida.org> added Note.
32 .\" Modified, 25 Jun 2002, Michael Kerrisk <mtk.manpages@gmail.com>
33 .\"     Corrected description of queue placement by sched_setparam() and
34 .\"             sched_setscheduler()
35 .\"     A couple of grammar clean-ups
36 .\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
37 .\" 2005-03-23, mtk, Added description of SCHED_BATCH.
38 .\" 2007-07-10, Carsten Emde <Carsten.Emde@osadl.org>
39 .\"     Add text on real-time features that are currently being
40 .\"     added to the mainline kernel.
41 .\" 2008-05-07, mtk; Rewrote and restructured various parts of the page to
42 .\"     improve readability.
43 .\"
44 .\" Worth looking at: http://rt.wiki.kernel.org/index.php
45 .\"
46 .\" FIXME: 2.6.32 added SCHED_RESET_ON_FORK
47 .\"
48 .\" Japanese Version Copyright (c) 1996 Akira Yoshiyama
49 .\"         all rights reserved.
50 .\" Translated Thu Jul 11 01:42:52 JST 1996
51 .\"         by Akira Yoshiyama <yosshy@jedi.seg.kobe-u.ac.jp>
52 .\" Modified Sun Nov 21 19:36:18 JST 1999
53 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
54 .\" Updated Wed Jan  1 JST 2003 by Kentaro Shirakata <argrath@ub32.org>
55 .\" Updated 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
56 .\" Updated & Modified 2005-10-10, Akihiro MOTOKI
57 .\" Updated 2006-04-16, Akihiro MOTOKI, Catch up to LDP v2.28
58 .\" Updated 2007-10-13, Akihiro MOTOKI, LDP v2.65
59 .\" Updated 2008-08-13, Akihiro MOTOKI, LDP v3.05
60 .\"
61 .\"WORD:        privileges              Æø¢
62 .\"WORD:        resource limit          ¥ê¥½¡¼¥¹À©¸Â
63 .\"WORD:        scheduling policy       ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼
64 .\"
65 .TH SCHED_SETSCHEDULER 2 2008-11-06 "Linux" "Linux Programmer's Manual"
66 .\"O .SH NAME
67 .SH Ì¾Á°
68 .\"O sched_setscheduler, sched_getscheduler \-
69 .\"O set and get scheduling policy/parameters
70 sched_setscheduler, sched_getscheduler \-
71 ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤È¥Ñ¥é¥á¡¼¥¿¤òÀßÄê/¼èÆÀ¤¹¤ë
72 .\"O .SH SYNOPSIS
73 .SH ½ñ¼°
74 .nf
75 .B #include <sched.h>
76 .sp
77 .BI "int sched_setscheduler(pid_t " pid ", int " policy ,
78 .br
79 .BI "                       const struct sched_param *" param );
80 .sp
81 .BI "int sched_getscheduler(pid_t " pid );
82 .sp
83 \fBstruct sched_param {
84     ...
85     int \fIsched_priority\fB;
86     ...
87 };
88 .fi
89 .\"O .SH DESCRIPTION
90 .SH ÀâÌÀ
91 .\"O .BR sched_setscheduler ()
92 .\"O sets both the scheduling policy and the associated parameters for the
93 .\"O process whose ID is specified in \fIpid\fP.
94 .\"O If \fIpid\fP equals zero, the
95 .\"O scheduling policy and parameters of the calling process will be set.
96 .\"O The interpretation of
97 .\"O the argument \fIparam\fP depends on the selected policy.
98 .\"O Currently, Linux supports the following "normal"
99 .\"O (i.e., non-real-time) scheduling policies:
100 .BR sched_setscheduler ()
101 ¤Ï \fIpid\fP ¤Ç»ØÄꤵ¤ì¤¿ ID ¤ò»ý¤Ä¥×¥í¥»¥¹¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤ä
102 ¤½¤ì¤Ë´ØÏ¢¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤òÀßÄꤹ¤ë¡£\fIpid\fP ¤¬ 0 ¤Î¾ì¹ç¤Ï
103 ¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤È¥Ñ¥é¥á¡¼¥¿¤¬ÀßÄꤵ¤ì¤ë¡£
104 °ú¤­¿ô \fIparam\fP ¤Î²ò¼á¤ÏÁªÂò¤µ¤ì¤¿¥Ý¥ê¥·¡¼¤Ë¤è¤ë¡£
105 ¸½ºß¤Î¤È¤³¤í¡¢Linux ¤Ç¤Ï
106 °Ê²¼¤Ë¼¨¤¹¡ÖÄ̾ï¡×(¥ê¥¢¥ë¥¿¥¤¥à¤Ç¤Ê¤¤) ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤¬
107 ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
108 .TP 14
109 .BR SCHED_OTHER
110 .\"O the standard round-robin time-sharing policy;
111 ɸ½à¤Î¡¢¥é¥¦¥ó¥É¥í¥Ó¥ó¤Ë¤è¤ë»þʬ³ä·¿¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¡£
112 .\"O .\" In the 2.6 kernel sources, SCHED_OTHER is actually called
113 .\"O .\" SCHED_NORMAL.
114 .\" 2.6 ¥«¡¼¥Í¥ë¥½¡¼¥¹¤Ç¤Ï¡¢SCHED_OTHER ¤Ï¼ÂºÝ¤Ë¤Ï
115 .\" SCHED_NORMAL ¤È¸Æ¤Ð¤ì¤Æ¤¤¤ë¡£
116 .TP
117 .BR SCHED_BATCH
118 .\"O for "batch" style execution of processes; and
119 ¡Ö¥Ð¥Ã¥Á¡×·Á¼°¤Ç¤Î¥×¥í¥»¥¹¤Î¼Â¹ÔÍÑ¡£
120 .TP
121 .BR SCHED_IDLE
122 .\"O for running
123 .\"O .I very
124 .\"O low priority background jobs.
125 ¡ÖÈó¾ï¤Ë¡×Ä㤤ͥÀèÅÙ¤ÇÆ°ºî¤¹¤ë¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¡¦¥¸¥ç¥ÖÍÑ¡£
126 .PP
127 .\"O The following "real-time" policies are also supported,
128 .\"O for special time-critical applications that need precise control over
129 .\"O the way in which runnable processes are selected for execution:
130 ¤É¤Î¼Â¹Ô²Äǽ¥×¥í¥»¥¹¤òÁªÂò¤¹¤ë¤«¤Ë¤Ä¤¤¤Æ¡¢¤è¤êÀµ³Î¤ÊÀ©¸æ¤òɬÍפȤ¹¤ë
131 »þ´Ö¤ÎÀ©Ì󤬸·¤·¤¤ÆÃÊ̤ʥ¢¥×¥ê¥±¡¼¥·¥ç¥óÍѤȤ·¤Æ¡¢
132 °Ê²¼¤Î¡Ö¥ê¥¢¥ë¥¿¥¤¥à¡×¥Ý¥ê¥·¡¼¤â¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
133 .TP 14
134 .BR SCHED_FIFO
135 .\"O a first-in, first-out policy; and
136 ¥Õ¥¡¡¼¥¹¥È¥¤¥ó¡¢¥Õ¥¡¡¼¥¹¥È¥¢¥¦¥È·¿¤Î¥Ý¥ê¥·¡¼¡£
137 .TP
138 .BR SCHED_RR
139 .\"O a round-robin policy.
140 ¥é¥¦¥ó¥É¥í¥Ó¥ó·¿¤Î¥Ý¥ê¥·¡¼¡£
141 .PP
142 .\"O The semantics of each of these policies are detailed below.
143 ¤³¤ì¤é¤Î¥Ý¥ê¥·¡¼¤Î¤½¤ì¤¾¤ì¤ÎÆ°ºî¤Ë¤Ä¤¤¤Æ¤Ï°Ê²¼¤ÇÀâÌÀ¤¹¤ë¡£
144
145 .\"O .BR sched_getscheduler ()
146 .\"O queries the scheduling policy currently applied to the process
147 .\"O identified by \fIpid\fP.
148 .\"O If \fIpid\fP equals zero, the policy of the
149 .\"O calling process will be retrieved.
150 .BR sched_getscheduler ()
151 ¤Ï \fIpid\fP ¤Ç¼±Ê̤µ¤ì¤ë¥×¥í¥»¥¹¤Ë¸½ºßŬÍѤµ¤ì¤Æ¤¤¤ë
152 ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤ò¿Ò¤Í¤ë¡£\fIpid\fP ¤¬ 0 ¤Ê¤é¤Ð¡¢¸Æ¤Ó½Ð¤·¤¿
153 ¥×¥í¥»¥¹¼«¿È¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤¬ÊÖ¤µ¤ì¤ë¡£
154 .\"
155 .\"O .SS Scheduling Policies
156 .SS ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼ (scheduling policy)
157 .\"O The scheduler is the kernel component that decides which runnable process
158 .\"O will be executed by the CPU next.
159 .\"O Each process has an associated scheduling policy and a \fIstatic\fP
160 .\"O scheduling priority, \fIsched_priority\fP; these are the settings
161 .\"O that are modified by
162 .\"O .BR sched_setscheduler ().
163 .\"O The scheduler makes it decisions based on knowledge of the scheduling
164 .\"O policy and static priority of all processes on the system.
165 ¥¹¥±¥¸¥å¡¼¥é (scheduler) ¤È¤Ï¥«¡¼¥Í¥ë¤Î¹½À®Í×ÁǤǡ¢
166 ¼¡¤Ë CPU ¤Ç¼Â¹Ô¤µ¤ì¤ë¼Â¹Ô²Äǽ¤Ê¥×¥í¥»¥¹¤ò·èÄꤹ¤ë¤â¤Î¤Ç¤¢¤ë¡£
167 ³Æ¡¹¤Î¥×¥í¥»¥¹¤Ë¤Ï¡¢¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤È
168 ¡ÖÀÅŪ¡×¤Ê¥¹¥±¥¸¥å¡¼¥ê¥ó¥°Í¥ÀèÅÙ \fIsched_priority\fP ¤¬ÂбþÉÕ¤±¤é¤ì¡¢
169 ¤³¤ì¤é¤ÎÀßÄê¤Ï
170 .BR sched_setscheduler ()
171 ¤ÇÊѹ¹¤Ç¤­¤ë¡£
172 ¥¹¥±¥¸¥å¡¼¥é¤Ï¡¢¥·¥¹¥Æ¥à¾å¤ÎÁ´¥×¥í¥»¥¹¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤È
173 ÀÅŪͥÀèÅ٤˴ؤ¹¤ëÃμ±¤Ë´ð¤Å¤¤¤Æ·èÄê¤ò¹Ô¤¦¡£
174
175 .\"O For processes scheduled under one of the normal scheduling policies
176 .\"O (\fBSCHED_OTHER\fP, \fBSCHED_IDLE\fP, \fBSCHED_BATCH\fP),
177 .\"O \fIsched_priority\fP is not used in scheduling
178 .\"O decisions (it must be specified as 0).
179 Ä̾ï¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼
180 (\fBSCHED_OTHER\fP, \fBSCHED_IDLE\fP, \fBSCHED_BATCH\fP)
181 ¤Î²¼¤Ç¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤µ¤ì¤ë¥×¥í¥»¥¹¤Ç¤Ï¡¢
182 \fIsched_priority\fP ¤Ï¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤Î·èÄê¤Ë»ÈÍѤµ¤ì¤Ê¤¤
183 (\fIsched_priority\fP ¤Ë¤Ï 0 ¤ò»ØÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤)¡£
184
185 .\"O Processes scheduled under one of the real-time policies
186 .\"O (\fBSCHED_FIFO\fP, \fBSCHED_RR\fP) have a
187 .\"O \fIsched_priority\fP value in the range 1 (low) to 99 (high).
188 .\"O (As the numbers imply, real-time processes always have higher priority
189 .\"O than normal processes.)
190 ¥ê¥¢¥ë¥¿¥¤¥à¡¦¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼ (\fBSCHED_FIFO\fP, \fBSCHED_RR\fP)
191 ¤Î²¼¤Ç¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤µ¤ì¤ë¥×¥í¥»¥¹¤Ï¡¢
192 \fIsched_priority\fP ¤ÎÃͤϠ1 (ºÇÄã) ¤«¤é 99 (ºÇ¹â) ¤ÎÈϰϤȤʤë
193 (¿ô»ú¤«¤éʬ¤«¤ë¤è¤¦¤Ë¡¢¥ê¥¢¥ë¥¿¥¤¥à¡¦¥×¥í¥»¥¹¤Ï¾ï¤ËÄ̾ï¤Î¥×¥í¥»¥¹¤è¤ê¤â
194 ¹â¤¤Í¥ÀèÅÙ¤ò»ý¤Ä)¡£
195 .\"O Note well: POSIX.1-2001 only requires an implementation to support a
196 .\"O minimum 32 distinct priority levels for the real-time policies,
197 .\"O and some systems supply just this minimum.
198 .\"O Portable programs should use
199 .\"O .BR sched_get_priority_min (2)
200 .\"O and
201 .\"O .BR sched_get_priority_max (2)
202 .\"O to find the range of priorities supported for a particular policy.
203 ¤³¤³¤ÇÃí°Õ¤¹¤Ù¤­¤Ê¤Î¤Ï¡¢POSIX.1-2001 ¤¬Í׵ᤷ¤Æ¤¤¤ë¤Î¤Ï¡¢
204 ¥ê¥¢¥ë¥¿¥¤¥à¡¦¥Ý¥ê¥·¡¼¤Î¼ÂÁõ¤Ë¤ª¤¤¤ÆºÇÄã 32 ¼ïÎà¤Î°Û¤Ê¤ëÍ¥ÀèÅÙ¥ì¥Ù¥ë¤¬
205 ¥µ¥Ý¡¼¥È¤µ¤ì¤ë¤³¤È¤À¤±¤Ç¤¢¤ê¡¢¤¤¤¯¤Ä¤«¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¤³¤ÎºÇÄã¸Â¤Î¿ô¤Î
206 Í¥ÀèÅÙ¤·¤«Ä󶡤µ¤ì¤Æ¤¤¤Ê¤¤¡¢¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£
207 °Ü¿¢À­¤¬É¬Í×¤Ê¥×¥í¥°¥é¥à¤Ç¤Ï¡¢
208 .BR sched_get_priority_min (2)
209 ¤È
210 .BR sched_get_priority_max (2)
211 ¤ò»È¤Ã¤Æ¡¢¤¢¤ë¥Ý¥ê¥·¡¼¤¬¥µ¥Ý¡¼¥È¤¹¤ëÍ¥ÀèÅÙ¤ÎÈϰϤòÄ´¤Ù¤ë¤Ù¤­¤Ç¤¢¤ë¡£
212
213 .\"O Conceptually, the scheduler maintains a list of runnable
214 .\"O processes for each possible \fIsched_priority\fP value.
215 .\"O In order to determine which process runs next, the scheduler looks for
216 .\"O the nonempty list with the highest static priority and selects the
217 .\"O process at the head of this list.
218 ³µÇ°¤È¤·¤Æ¤Ï¡¢
219 ¥¹¥±¥¸¥å¡¼¥é¤Ï¤½¤Î \fIsched_priority\fP ¤ÎÃͤ½¤ì¤¾¤ì¤ËÂФ·¤Æ
220 ¼Â¹Ô²Äǽ¤Ê¥×¥í¥»¥¹¤Î¥ê¥¹¥È¤ò´ÉÍý¤·¤Æ¤¤¤ë¡£
221 ¤É¤Î¥×¥í¥»¥¹¤ò¼¡¤Ë¼Â¹Ô¤¹¤ë¤«¤ò·èÄꤹ¤ë¤¿¤á¤Ë¡¢
222 ¥¹¥±¥¸¥å¡¼¥é¤ÏÀÅŪͥÀèÅ٤κǤâ¹â¤¤¶õ¤Ç¤Ê¤¤¥ê¥¹¥È¤òõ¤·¤Æ¡¢
223 ¤½¤Î¥ê¥¹¥È¤ÎÀèƬ¤Î¥×¥í¥»¥¹¤òÁªÂò¤¹¤ë¡£
224
225 .\"O A process's scheduling policy determines
226 .\"O where it will be inserted into the list of processes
227 .\"O with equal static priority and how it will move inside this list.
228 ³Æ¥×¥í¥»¥¹¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤Ï¡¢
229 ¤½¤Î¥×¥í¥»¥¹¤¬Æ±¤¸ÀÅŪͥÀèÅÙ¤ò»ý¤Ä¥×¥í¥»¥¹¤Î¥ê¥¹¥È¤ÎÃæ¤Î¤É¤³¤ËÁÞÆþ¤µ¤ì¡¢
230 ¤³¤Î¥ê¥¹¥È¤ÎÃæ¤ò¤É¤Î¤è¤¦¤Ë°ÜÆ°¤¹¤ë¤«¤ò·èÄꤹ¤ë¡£
231
232 .\"O All scheduling is preemptive: if a process with a higher static
233 .\"O priority becomes ready to run, the currently running process
234 .\"O will be preempted and
235 .\"O returned to the wait list for its static priority level.
236 .\"O The scheduling policy only determines the
237 .\"O ordering within the list of runnable processes with equal static
238 .\"O priority.
239 Á´¤Æ¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤Ï¥×¥ê¥¨¥ó¥×¥Æ¥£¥Ö (preemptive) ¤Ç¤¢¤ë:
240 ¤è¤ê¹â¤¤Í¥ÀèÅÙ¤Î¥×¥í¥»¥¹¤¬¼Â¹Ô²Äǽ¤Ë¤Ê¤ë¤È¡¢¸½ºß¼Â¹ÔÃæ¤Î¥×¥í¥»¥¹¤Ï¼Â¹Ô¸¢¤ò
241 ¼è¤ê¾å¤²¤é¤ì (preempted)¡¢¤½¤Î¥×¥í¥»¥¹¤ÎÀÅŪͥÀèÅÙ¥ì¥Ù¥ë¤ÎÂÔ¤Á¥ê¥¹¥È¤Ë
242 Ìᤵ¤ì¤ë¡£¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤ÏƱ¤¸ÀÅŪͥÀèÅÙ¤ò»ý¤Ä¼Â¹Ô²Äǽ¤Ê
243 ¥×¥í¥»¥¹¤Î¥ê¥¹¥È¤ÎÃæ¤Ç½çÈ֤Τߤò·èÄꤹ¤ë¡£
244 .\"O .SS SCHED_FIFO: First In-First Out scheduling
245 .SS SCHED_FIFO: ¥Õ¥¡¡¼¥¹¥È¥¤¥ó¡¦¥Õ¥¡¡¼¥¹¥È¥¢¥¦¥È¡¦¥¹¥±¥¸¥å¡¼¥ê¥ó¥°
246 .\"O \fBSCHED_FIFO\fP can only be used with static priorities higher than
247 .\"O 0, which means that when a \fBSCHED_FIFO\fP processes becomes runnable,
248 .\"O it will always immediately preempt any currently running
249 .\"O \fBSCHED_OTHER\fP, \fBSCHED_BATCH\fP, or \fBSCHED_IDLE\fP process.
250 .\"O \fBSCHED_FIFO\fP is a simple scheduling
251 .\"O algorithm without time slicing.
252 .\"O For processes scheduled under the
253 .\"O \fBSCHED_FIFO\fP policy, the following rules apply:
254 \fBSCHED_FIFO\fP ¤Ï 0 ¤è¤êÂ礭¤ÊÀÅŪͥÀèÅ٤ǤΤ߻ÈÍѤǤ­¤ë¡£¤³¤Î¥Ý¥ê¥·¡¼¤Ç¤Ï¡¢
255 \fBSCHED_FIFO\fP ¥×¥í¥»¥¹¤¬¼Â¹Ô²Äǽ¤Ë¤Ê¤Ã¤¿¾ì¹ç¡¢
256 ¤½¤Î¥Ý¥ê¥·¡¼¤¬ \fBSCHED_OTHER\fP¡¢ \fBSCHED_BATCH\fP¡¢ \fBSCHED_IDLE\fP ¤Î
257 ¸½ºß¼Â¹ÔÃæ¤Î¥×¥í¥»¥¹¤Ïľ¤Á¤Ë¼Â¹Ô¸¢¤ò¼è¤ê¾å¤²¤é¤ì¤ë¡£
258 \fBSCHED_FIFO\fP ¤Ï»þʬ³ä¤Î¤Ê¤¤Ã±½ã¤Ê¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥¢¥ë¥´¥ê¥º¥à¤Ç¤¢¤ë¡£
259 \fBSCHED_FIFO\fP ¥Ý¥ê¥·¡¼¤Ç¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤µ¤ì¤Æ¤¤¤ë¥×¥í¥»¥¹¤Ë¤Ï°Ê²¼¤Î
260 ¥ë¡¼¥ë¤¬Å¬ÍѤµ¤ì¤ë:
261 .IP * 3
262 .\"O A \fBSCHED_FIFO\fP process that has been preempted by another process of
263 .\"O higher priority will stay at the head of the list for its priority and
264 .\"O will resume execution as soon as all processes of higher priority are
265 .\"O blocked again.
266 ¤è¤ê¹â¤¤Í¥ÀèÅ٤ξ¤Î¥×¥í¥»¥¹¤Ë¤è¤Ã¤Æ¼è¤Ã¤ÆÂå¤ï¤é¤ì¤¿
267 \fBSCHED_FIFO\fP ¥×¥í¥»¥¹¤Ï¤½¤ÎÍ¥ÀèÅ٤Υꥹ¥È¤ÎÀèƬ¤Ëα¤Þ¤ê³¤±¡¢
268 ¤è¤ê¹â¤¤Í¥ÀèÅÙ¤Î¥×¥í¥»¥¹Á´¤Æ¤¬Ää»ß (block) ¤·¤¿¾ì¹ç¤Ë¼Â¹Ô¤òºÆ³«¤¹¤ë¡£
269 .IP *
270 .\"O When a \fBSCHED_FIFO\fP process becomes runnable, it
271 .\"O will be inserted at the end of the list for its priority.
272 \fBSCHED_FIFO\fP ¥×¥í¥»¥¹¤¬¼Â¹Ô²Äǽ¤Ë¤Ê¤Ã¤¿»þ¡¢¤½¤ÎÍ¥ÀèÅ٤Υꥹ¥È¤ÎºÇ¸å
273 ¤ËÁÞÆþ¤µ¤ì¤ë¡£
274 .IP *
275 .\"O A call to
276 .\"O .BR sched_setscheduler ()
277 .\"O or
278 .\"O .BR sched_setparam (2)
279 .\"O will put the
280 .\"O \fBSCHED_FIFO\fP (or \fBSCHED_RR\fP) process identified by
281 .\"O \fIpid\fP at the start of the list if it was runnable.
282 .BR sched_setscheduler ()
283 ¤ä
284 .BR sched_setparam (2)
285 ¤Ï
286 \fIpid\fP ¤Ç»ØÄꤵ¤ì¤¿ \fBSCHED_FIFO\fP (¤Þ¤¿¤Ï \fBSCHED_RR\fP) ¥×¥í¥»¥¹¤¬
287 ¼Â¹Ô²Äǽ¤Ê¾ì¹ç¡¢¥ê¥¹¥È¤ÎºÇ½é¤ËÃÖ¤¯¡£
288 .\"O As a consequence, it may preempt the currently running process if
289 .\"O it has the same priority.
290 .\"O (POSIX.1-2001 specifies that the process should go to the end
291 .\"O of the list.)
292 ·ë²Ì¤È¤·¤Æ¡¢¤â¤·Í¥ÀèÅÙ¤¬Æ±¤¸¤À¤Ã¤¿¾ì¹ç¡¢
293 ¸½ºß¼Â¹ÔÃæ¤Î¥×¥í¥»¥¹¤ËÀè¤ó¤¸¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
294 (POSIX.1-2001 ¤Ç¤Ï¥×¥í¥»¥¹¤Ï¥ê¥¹¥È¤ÎºÇ¸å¤Ë¹Ô¤¯¤Ù¤­¤Èµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£)
295 .\" In 2.2.x and 2.4.x, the process is placed at the front of the queue
296 .\" In 2.0.x, the Right Thing happened: the process went to the back -- MTK
297 .IP *
298 .\"O A process calling
299 .\"O .BR sched_yield (2)
300 .\"O will be put at the end of the list.
301 .BR sched_yield (2)
302 ¤ò¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Ï¥ê¥¹¥È¤ÎºÇ¸å¤ËÃÖ¤«¤ì¤ë¡£
303 .PP
304 .\"O No other events will move a process
305 .\"O scheduled under the \fBSCHED_FIFO\fP policy in the wait list of
306 .\"O runnable processes with equal static priority.
307 ¤½¤Î¾¤Î¥¤¥Ù¥ó¥È¤Ë¤è¤Ã¤Æ \fBSCHED_FIFO\fP ¥Ý¥ê¥·¡¼¤Ç
308 ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤µ¤ì¤ë¥×¥í¥»¥¹¤¬Æ±¤¸Í¥ÀèÅ٤μ¹ԲÄǽ¤Ê
309 ¥×¥í¥»¥¹¤ÎÂÔ¤Á¥ê¥¹¥È¤ÎÃæ¤ò°ÜÆ°¤¹¤ë¤³¤È¤Ï¤Ê¤¤¡£
310
311 .\"O A \fBSCHED_FIFO\fP
312 .\"O process runs until either it is blocked by an I/O request, it is
313 .\"O preempted by a higher priority process, or it calls
314 .\"O .BR sched_yield (2).
315 \fBSCHED_FIFO\fP ¥×¥í¥»¥¹¤Ï I/O Í×µá¤Ë¤è¤Ã¤ÆÄä»ß¤¹¤ë¤«¡¢
316 ¤è¤ê¹â¤¤Í¥ÀèÅÙ¤Î¥×¥í¥»¥¹¤Ë¤è¤Ã¤ÆÃÖ¤­¤«¤¨¤é¤ì¤ë¤«¡¢
317 .BR sched_yield (2)
318 ¤ò¸Æ¤Ó½Ð¤¹¤Þ¤Ç¼Â¹Ô¤ò³¤±¤ë¡£
319 .\"O .SS SCHED_RR: Round Robin scheduling
320 .SS SCHED_RR: ¥é¥¦¥ó¥É¡¦¥í¥Ó¥ó (round robin) ¡¦¥¹¥±¥¸¥å¡¼¥ê¥ó¥°
321 .\"O \fBSCHED_RR\fP is a simple enhancement of \fBSCHED_FIFO\fP.
322 .\"O Everything
323 .\"O described above for \fBSCHED_FIFO\fP also applies to \fBSCHED_RR\fP,
324 .\"O except that each process is only allowed to run for a maximum time
325 .\"O quantum.
326 .\"O If a \fBSCHED_RR\fP process has been running for a time
327 .\"O period equal to or longer than the time quantum, it will be put at the
328 .\"O end of the list for its priority.
329 .\"O A \fBSCHED_RR\fP process that has
330 .\"O been preempted by a higher priority process and subsequently resumes
331 .\"O execution as a running process will complete the unexpired portion of
332 .\"O its round robin time quantum.
333 .\"O The length of the time quantum can be
334 .\"O retrieved using
335 .\"O .BR sched_rr_get_interval (2).
336 \fBSCHED_RR\fP ¤Ï \fBSCHED_FIFO\fP ¤Îñ½ã¤Ê³ÈÄ¥¤Ç¤¢¤ë¡£
337 ¾å½Ò¤µ¤ì¤¿ \fBSCHED_FIFO\fP ¤Ë´Ø¤¹¤ëµ­½Ò¤ÏÁ´¤Æ \fBSCHED_RR\fP ¤Ë
338 ŬÍѤǤ­¤ë¡£°Û¤Ê¤ë¤Î¤Ï¤½¤ì¤¾¤ì¤Î¥×¥í¥»¥¹¤ÏºÇÂç»þ´Öñ°Ì¤Þ¤Ç¤·¤«¼Â¹Ô¤Ç¤­¤Ê¤¤
339 ¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£\fBSCHED_RR\fP ¥×¥í¥»¥¹¤¬»þ´Öñ°Ì¤ÈƱ¤¸¤«¤½¤ì¤è¤ê
340 Ť¤»þ´Ö¼Â¹Ô¤µ¤ì¤ë¤È¡¢¤½¤ÎÍ¥ÀèÅ٤Υꥹ¥È¤ÎºÇ¸å¤ËÃÖ¤«¤ì¤ë¡£
341 ¤è¤ê¹â¤¤Í¥ÀèÅÙ¤Î¥×¥í¥»¥¹¤Ë¤è¤Ã¤ÆÃÖ¤­¤«¤¨¤é¤ì¡¢¤½¤Î¸å¼Â¹Ô¤òºÆ³«¤·¤¿
342 \fBSCHED_RR\fP ¥×¥í¥»¥¹¤Ï¡¢¤½¤Î¥é¥¦¥ó¥É¡¦¥í¥Ó¥ó»þ´Öñ°Ì¤ò´°Á´¤Ë»È¤¤ÀÚ¤ë
343 ¤Þ¤Ç¼Â¹Ô¤µ¤ì¤ë¡£¤½¤Î»þ´Öñ°Ì¤ÎŤµ¤Ï
344 .BR sched_rr_get_interval (2)
345 ¤ò»È¤Ã¤Æ¼èÆÀ¤Ç¤­¤ë¡£
346 .\" On Linux 2.4, the length of the RR interval is influenced
347 .\" by the process nice value -- MTK
348 .\"
349 .\"O .SS SCHED_OTHER: Default Linux time-sharing scheduling
350 .SS SCHED_OTHER: Linux ¤Î¥Ç¥Õ¥©¥ë¥È¤Î»þʬ³ä¥¹¥±¥¸¥å¡¼¥ê¥ó¥°
351 .\"O \fBSCHED_OTHER\fP can only be used at static priority 0.
352 .\"O \fBSCHED_OTHER\fP is the standard Linux time-sharing scheduler that is
353 .\"O intended for all processes that do not require the special
354 .\"O real-time mechanisms.
355 .\"O The process to run is chosen from the static
356 .\"O priority 0 list based on a \fIdynamic\fP priority that is determined only
357 .\"O inside this list.
358 .\"O The dynamic priority is based on the nice value (set by
359 .\"O .BR nice (2)
360 .\"O or
361 .\"O .BR setpriority (2))
362 .\"O and increased for each time quantum the process is ready to run,
363 .\"O but denied to run by the scheduler.
364 .\"O This ensures fair progress among all \fBSCHED_OTHER\fP processes.
365 \fBSCHED_OTHER\fP ¤ÏÀÅŪͥÀèÅÙ 0 ¤Ç¤Î¤ß»ÈÍѤǤ­¤ë¡£
366 \fBSCHED_OTHER\fP ¤Ï Linux É¸½à¤Î»þʬ³ä¥¹¥±¥¸¥å¡¼¥é¤Ç¡¢
367 ÆÃÊ̤ʥꥢ¥ë¥¿¥¤¥àµ¡¹½¤òɬÍפȤ·¤Æ¤¤¤Ê¤¤Á´¤Æ¤Î¥×¥í¥»¥¹¤Ç»ÈÍѤµ¤ì¤ë¡£
368 ¼Â¹Ô¤¹¤ë¥×¥í¥»¥¹¤Ï¡¢ÀÅŪͥÀèÅÙ 0 ¤Î¥ê¥¹¥È¤«¤é¡¢¤³¤Î¥ê¥¹¥È¤ÎÃæ¤À¤±¤Ç
369 ·èÄꤵ¤ì¤ë¡ÖưŪ¤Ê¡×Í¥ÀèÅÙ (dynamic priority) ¤Ë´ð¤¤¤Æ·èÄꤵ¤ì¤ë¡£
370 ưŪ¤ÊÍ¥ÀèÅÙ¤Ï
371 .RB ( nice (2)
372 ¤ä
373 .BR setpriority (2)
374 ¤Ë¤è¤êÀßÄꤵ¤ì¤ë) nice Ãͤ˴ð¤Å¤¤¤Æ·èÄꤵ¤ì¤ë¤â¤Î¤Ç¡¢
375 ñ°Ì»þ´ÖËè¤Ë¡¢¥×¥í¥»¥¹¤¬¼Â¹Ô²Äǽ¤À¤¬¡¢¥¹¥±¥¸¥å¡¼¥é¤Ë¤è¤ê¼Â¹Ô¤¬µñÈݤµ¤ì¤¿
376 ¾ì¹ç¤Ë¥¤¥ó¥¯¥ê¥á¥ó¥È¤µ¤ì¤ë¡£
377 ¤³¤ì¤Ë¤è¤ê¡¢Á´¤Æ¤Î \fBSCHED_OTHER\fP ¥×¥í¥»¥¹¤Ç¤Î¸øÊ¿À­¤¬Êݾڤµ¤ì¤ë¡£
378 .\"
379 .\"O .SS SCHED_BATCH: Scheduling batch processes
380 .SS SCHED_BATCH: ¥Ð¥Ã¥Á¥×¥í¥»¥¹¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°
381 .\"O (Since Linux 2.6.16.)
382 (Linux 2.6.16 °Ê¹ß)
383 .\"O \fBSCHED_BATCH\fP can only be used at static priority 0.
384 .\"O This policy is similar to \fBSCHED_OTHER\fP in that it schedules
385 .\"O the process according to its dynamic priority
386 .\"O (based on the nice value).
387 .\"O The difference is that this policy
388 .\"O will cause the scheduler to always assume
389 .\"O that the process is CPU-intensive.
390 .\"O Consequently, the scheduler will apply a small scheduling
391 .\"O penalty with respect to wakeup behaviour,
392 .\"O so that this process is mildly disfavored in scheduling decisions.
393 \fBSCHED_BATCH\fP ¤ÏÀÅŪͥÀèÅÙ 0 ¤Ç¤Î¤ß»ÈÍѤǤ­¤ë¡£
394 ¤³¤Î¥Ý¥ê¥·¡¼¤Ï (nice Ãͤ˴ð¤Å¤¯) Æ°Åª¤ÊÍ¥ÀèÅ٤ˤ·¤¿¤¬¤Ã¤Æ¥×¥í¥»¥¹¤Î
395 ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤¬¹Ô¤ï¤ì¤ë¤È¤¤¤¦ÅÀ¤Ç¡¢\fBSCHED_OTHER\fP ¤Ë»÷¤Æ¤¤¤ë¡£
396 °Û¤Ê¤ë¤Î¤Ï¡¢¤³¤Î¥Ý¥ê¥·¡¼¤Ç¤Ï¡¢¥×¥í¥»¥¹¤¬¾ï¤Ë CPU ¤ËÉé²Ù¤Î¤«¤«¤ë (CPU-intensive)
397 ½èÍý¤ò¹Ô¤¦¤È¡¢¥¹¥±¥¸¥å¡¼¥é¤¬²¾Äꤹ¤ëÅÀ¤Ç¤¢¤ë¡£
398 ¥¹¥±¥¸¥å¡¼¥é¤Ï¥×¥í¥»¥¹¤ò¸Æ¤Óµ¯¤³¤¹Ëè¤Ë¤½¤Î¥×¥í¥»¥¹¤Ë¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¾å¤Î
399 ¥Ú¥Ê¥ë¥Æ¥£¤ò¾¯¤·²Ý¤·¡¢¤½¤Î·ë²Ì¡¢¤³¤Î¥×¥í¥»¥¹¤Ï¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤Î·èÄê¤Ç
400 ¼ã´³Îä¶ø¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
401
402 .\" The following paragraph is drawn largely from the text that
403 .\" accompanied Ingo Molnar's patch for the implementation of
404 .\" SCHED_BATCH.
405 .\"O This policy is useful for workloads that are noninteractive,
406 .\"O but do not want to lower their nice value,
407 .\"O and for workloads that want a deterministic scheduling policy without
408 .\"O interactivity causing extra preemptions (between the workload's tasks).
409 ¤³¤Î¥Ý¥ê¥·¡¼¤Ï¡¢ÈóÂÐÏÃŪ¤Ê½èÍý¤À¤¬¤½¤Î nice Ãͤò²¼¤²¤¿¤¯¤Ê¤¤½èÍý¤ä¡¢
410 (½èÍý¤Î¥¿¥¹¥¯´Ö¤Ç) Í¾·×¤Ê¥¿¥¹¥¯¤ÎÃÖ¤­´¹¤¨¤Î¸¶°ø¤È¤¢¤ëÂÐÏÃŪ¤Ê½èÍý¤Ê¤·¤Ç
411 ³ÎÄêŪ¤Ê (deterministic) ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤òŬÍѤ·¤¿¤¤½èÍý¤Ë
412 ÂФ·¤ÆÍ­¸ú¤Ç¤¢¤ë¡£
413 .\"
414 .\"O .SS SCHED_IDLE: Scheduling very low priority jobs
415 .SS SCHED_IDLE: Èó¾ï¤ËÍ¥ÀèÅÙ¤ÎÄ㤤¥¸¥ç¥Ö¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°
416 .\"O (Since Linux 2.6.23.)
417 (Linux 2.6.23 °Ê¹ß)
418 .\"O \fBSCHED_IDLE\fP can only be used at static priority 0;
419 .\"O the process nice value has no influence for this policy.
420 \fBSCHED_IDLE\fP ¤ÏÀÅŪͥÀèÅÙ 0 ¤Ç¤Î¤ß»ÈÍѤǤ­¤ë¡£
421 ¤³¤Î¥Ý¥ê¥·¡¼¤Ç¤Ï¥×¥í¥»¥¹¤Î nice Ãͤϥ¹¥±¥¸¥å¡¼¥ê¥ó¥°¤Ë±Æ¶Á¤òÍ¿¤¨¤Ê¤¤¡£
422
423 .\"O This policy is intended for running jobs at extremely low
424 .\"O priority (lower even than a +19 nice value with the
425 .\"O .B SCHED_OTHER
426 .\"O or
427 .\"O .B SCHED_BATCH
428 .\"O policies).
429 Èó¾ï¤ËÄ㤤ͥÀèÅ٤ǤΥ¸¥ç¥Ö¤Î¼Â¹Ô¤òÌÜŪ¤È¤·¤¿¤â¤Î¤Ç¤¢¤ë
430 (Èó¾ï¤ËÄ㤤ͥÀèÅ٤Ȥϡ¢¥Ý¥ê¥·¡¼
431 .B SCHED_OTHER
432 ¤«
433 .B SCHED_BATCH
434 ¤Ç¤Î nice ÃÍ +19 ¤è¤ê¤µ¤é¤ËÄ㤤ͥÀèÅ٤Ǥ¢¤ë)¡£
435 .\"
436 .\"O .SS Privileges and resource limits
437 .SS Æø¢¤È¥ê¥½¡¼¥¹À©¸Â
438 .\"O In Linux kernels before 2.6.12, only privileged
439 .\"O .RB ( CAP_SYS_NICE )
440 .\"O processes can set a nonzero static priority (i.e., set a real-time
441 .\"O scheduling policy).
442 .\"O The only change that an unprivileged process can make is to set the
443 .\"O .B SCHED_OTHER
444 .\"O policy, and this can only be done if the effective user ID of the caller of
445 .\"O .BR sched_setscheduler ()
446 .\"O matches the real or effective user ID of the target process
447 .\"O (i.e., the process specified by
448 .\"O .IR pid )
449 .\"O whose policy is being changed.
450 2.6.12 ¤è¤êÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤Î Linux ¥«¡¼¥Í¥ë¤Ç¤Ï¡¢
451 Æø¢¥×¥í¥»¥¹
452 .RB ( CAP_SYS_NICE
453 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹) ¤À¤±¤¬ 0 °Ê³°¤ÎÀÅŪͥÀèÅÙ¤òÀßÄꤹ¤ë
454 (¤¹¤Ê¤ï¤Á¡¢¥ê¥¢¥ë¥¿¥¤¥à¡¦¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤òÀßÄꤹ¤ë) ¤³¤È¤¬¤Ç¤­¤ë¡£
455 ÈóÆø¢¥×¥í¥»¥¹¤¬¤Ç¤­¤ëÊѹ¹¤Ï
456 .B SCHED_OTHER
457 ¥Ý¥ê¥·¡¼¤òÀßÄꤹ¤ë¤³¤È¤À¤±¤Ç¤¢¤ê¡¢¤µ¤é¤Ë¤³¤ÎÊѹ¹¤ò¹Ô¤¨¤ë¤Î¤Ï
458 .BR sched_setscheduler ()
459 ¤Î¸Æ¤Ó½Ð¤·¸µ¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤¬¥Ý¥ê¥·¡¼¤ÎÊѹ¹ÂÐ¾Ý¥×¥í¥»¥¹
460 .RI ( pid
461 ¤Ç»ØÄꤵ¤ì¤¿¥×¥í¥»¥¹) ¤Î¼Â¥æ¡¼¥¶ ID ¤«¼Â¸ú¥æ¡¼¥¶ ID ¤È
462 °ìÃפ¹¤ë¾ì¹ç¤À¤±¤Ç¤¢¤ë¡£
463
464 .\"O Since Linux 2.6.12, the
465 .\"O .B RLIMIT_RTPRIO
466 .\"O resource limit defines a ceiling on an unprivileged process's
467 .\"O static priority for the
468 .\"O .B SCHED_RR
469 .\"O and
470 .\"O .B SCHED_FIFO
471 .\"O policies.
472 Linux 2.6.12 °Ê¹ß¤Ç¤Ï¡¢¥ê¥½¡¼¥¹À©¸Â
473 .B RLIMIT_RTPRIO
474 ¤¬ÄêµÁ¤µ¤ì¤Æ¤ª¤ê¡¢
475 ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤¬
476 .B SCHED_RR
477 ¤È
478 .B SCHED_FIFO
479 ¤Î¾ì¹ç¤Î¡¢ÈóÆø¢¥×¥í¥»¥¹¤ÎÀÅŪͥÀèÅ٤ξå¸Â¤òÄê¤á¤Æ¤¤¤ë¡£
480 .\"O The rules for changing scheduling policy and priority are as follows:
481 ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤ÈÍ¥ÀèÅÙ¤òÊѹ¹¤¹¤ëºÝ¤Î¥ë¡¼¥ë¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë¡£
482 .IP * 2
483 .\"O If an unprivileged process has a nonzero
484 .\"O .B RLIMIT_RTPRIO
485 .\"O soft limit, then it can change its scheduling policy and priority,
486 .\"O subject to the restriction that the priority cannot be set to a
487 .\"O value higher than the maximum of its current priority and its
488 .\"O .B RLIMIT_RTPRIO
489 .\"O soft limit.
490 ÈóÆø¢¥×¥í¥»¥¹¤Ë 0 °Ê³°¤Î
491 .B RLIMIT_RTPRIO
492 ¥½¥Õ¥È¡¦¥ê¥ß¥Ã¥È¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
493 ÈóÆø¢¥×¥í¥»¥¹¤Ï¤½¤Î¥×¥í¥»¥¹¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤ÈÍ¥ÀèÅÙ¤ò
494 Êѹ¹¤Ç¤­¤ë¤¬¡¢Í¥ÀèÅÙ¤ò¸½ºß¤Î¼«¿È¤ÎÍ¥ÀèÅÙ¤È
495 .B RLIMIT_RTPRIO
496 ¥½¥Õ¥È¡¦¥ê¥ß¥Ã¥È¤ÎÂ礭¤¤Êý¤è¤ê¤â¹â¤¤ÃͤËÀßÄê¤Ç¤­¤Ê¤¤¤È¤¤¤¦À©¸Â¤¬²Ý¤µ¤ì¤ë¡£
497 .IP *
498 .\"O If the
499 .\"O .B RLIMIT_RTPRIO
500 .\"O soft limit is 0, then the only permitted changes are to lower the priority,
501 .\"O or to switch to a non-real-time policy.
502 .B RLIMIT_RTPRIO
503 ¥½¥Õ¥È¡¦¥ê¥ß¥Ã¥È¤¬ 0 ¤Î¾ì¹ç¡¢Í¥ÀèÅÙ¤ò²¼¤²¤ë¤«¡¢
504 ¥ê¥¢¥ë¥¿¥¤¥à¤Ç¤Ê¤¤¥Ý¥ê¥·¡¼¤ØÀÚ¤êÂؤ¨¤ë¤«¤ÎÊѹ¹¤À¤±¤¬µö²Ä¤µ¤ì¤ë¡£
505 .IP *
506 .\"O Subject to the same rules,
507 .\"O another unprivileged process can also make these changes,
508 .\"O as long as the effective user ID of the process making the change
509 .\"O matches the real or effective user ID of the target process.
510 ¤¢¤ëÈóÆø¢¥×¥í¥»¥¹¤¬ÊÌ¤Î¥×¥í¥»¥¹¤ËÂФ·¤Æ¤³¤ì¤é¤ÎÊѹ¹¤ò¹Ô¤¦ºÝ¤Ë¤â¡¢
511 Ʊ¤¸¥ë¡¼¥ë¤¬Å¬ÍѤµ¤ì¤ë¡£Êѹ¹¤ò¹Ô¤¨¤ë¤Î¤Ï¡¢Êѹ¹¤ò¹Ô¤ª¤¦¤È¤¹¤ë¥×¥í¥»¥¹
512 ¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤¬Êѹ¹ÂÐ¾Ý¤Î¥×¥í¥»¥¹¤Î¼Â¥æ¡¼¥¶ ID ¤«¼Â¸ú¥æ¡¼¥¶ ID ¤È
513 °ìÃפ·¤Æ¤¤¤ë¾ì¹ç¤Ë¸Â¤é¤ì¤ë¡£
514 .IP *
515 .\"O Special rules apply for the
516 .\"O .BR SCHED_IDLE :
517 .\"O an unprivileged process operating under this policy cannot
518 .\"O change its policy, regardless of the value of its
519 .\"O .BR RLIMIT_RTPRIO
520 .\"O resource limit.
521 .B SCHED_IDLE
522 ¤Ë¤ÏÆÃÊ̤ʥ롼¥ë¤¬Å¬ÍѤµ¤ì¡¢
523 ¤³¤Î¥Ý¥ê¥·¡¼¤Î²¼¤ÇÆ°ºî¤¹¤ëÈóÆø¢¥×¥í¥»¥¹¤Ï¡¢¥ê¥½¡¼¥¹À©¸Â
524 .B RLIMIT_RTPRIO
525 ¤ÎÃͤˤ«¤«¤ï¤é¤º¼«¿È¤Î¥Ý¥ê¥·¡¼¤òÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£
526 .PP
527 .\"O Privileged
528 .\"O .RB ( CAP_SYS_NICE )
529 .\"O processes ignore the
530 .\"O .B RLIMIT_RTPRIO
531 .\"O limit; as with older kernels,
532 .\"O they can make arbitrary changes to scheduling policy and priority.
533 Æø¢¥×¥í¥»¥¹
534 .RB ( CAP_SYS_NICE
535 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹) ¤Î¾ì¹ç¡¢
536 .B RLIMIT_RTPRIO
537 ¤ÎÀ©¸Â¤Ï̵»ë¤µ¤ì¤ë;
538 ¸Å¤¤¥«¡¼¥Í¥ë¤ÈƱ¤¸¤è¤¦¤Ë¡¢¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤ÈÍ¥ÀèÅÙ¤ËÂФ·
539 Ǥ°Õ¤ÎÊѹ¹¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤ë¡£
540 .\"O See
541 .\"O .BR getrlimit (2)
542 .\"O for further information on
543 .\"O .BR RLIMIT_RTPRIO .
544 .B RLIMIT_RTPRIO
545 ¤Ë´Ø¤¹¤ë¤â¤Ã¤È¾Ü¤·¤¤¾ðÊó¤Ï
546 .BR getrlimit (2)
547 ¤ò»²¾È¤Î¤³¤È¡£
548 .\"O .SS Response time
549 .SS ±þÅú»þ´Ö (response time)
550 .\"O A blocked high priority process waiting for the I/O has a certain
551 .\"O response time before it is scheduled again.
552 .\"O The device driver writer
553 .\"O can greatly reduce this response time by using a "slow interrupt"
554 .\"O interrupt handler.
555 .\"O .\" as described in
556 .\"O .\" .BR request_irq (9).
557 I/O ÂÔ¤Á¤ÇÄä»ß¤·¤¿¤è¤ê¹â¤¤Í¥ÀèÅÙ¤Î¥×¥í¥»¥¹¤ÏºÆ¤Ó¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤µ¤ì¤ë
558 Á°¤Ë¤¤¤¯¤é¤«¤Î±þÅú»þ´Ö¤¬¤«¤«¤ë¡£¥Ç¥Ð¥¤¥¹¡¦¥É¥é¥¤¥Ð¡¼¤ò½ñ¤¯¾ì¹ç¤Ë¤Ï
559 .\" .BR request_irq (9)
560 .\" ¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ë
561 "slow interrupt" ³ä¤ê¹þ¤ß¥Ï¥ó¥É¥é¡¼¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç
562 ¤³¤Î±þÅú»þ´Ö¤ò·àŪ¤Ë¸º¾¯¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
563 .\"O .SS Miscellaneous
564 .SS ¤½¤Î¾
565 .\"O Child processes inherit the scheduling policy and parameters across a
566 .\"O .BR fork (2).
567 .\"O The scheduling policy and parameters are preserved across
568 .\"O .BR execve (2).
569 »Ò¥×¥í¥»¥¹¤Ï
570 .BR fork (2)
571 ¤ÎºÝ¤Ë¿Æ¥×¥í¥»¥¹¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤È¥Ñ¥é¥á¡¼¥¿¤ò·Ñ¾µ¤¹¤ë¡£
572 .BR execve (2)
573 ¤ÎÁ°¸å¤Ç¡¢¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤È¥Ñ¥é¥á¡¼¥¿¤ÏÊÝ»ý¤µ¤ì¤ë¡£
574
575 .\"O Memory locking is usually needed for real-time processes to avoid
576 .\"O paging delays; this can be done with
577 .\"O .BR mlock (2)
578 .\"O or
579 .\"O .BR mlockall (2).
580 ¥ê¥¢¥ë¥¿¥¤¥à¡¦¥×¥í¥»¥¹¤ÏÂçÄñ¡¢¥Ú¡¼¥¸¥ó¥°¤ÎÂÔ¤Á»þ´Ö¤òÈò¤±¤ë¤¿¤á¤Ë
581 .BR mlock (2)
582 ¤ä
583 .BR mlockall (2)
584 ¤ò»È¤Ã¤Æ¥á¥â¥ê¡¦¥í¥Ã¥¯¤ò¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
585
586 .\"O Since a nonblocking infinite loop in a process scheduled under
587 .\"O \fBSCHED_FIFO\fP or \fBSCHED_RR\fP will block all processes with lower
588 .\"O priority forever, a software developer should always keep available on
589 .\"O the console a shell scheduled under a higher static priority than the
590 .\"O tested application.
591 .\"O This will allow an emergency kill of tested
592 .\"O real-time applications that do not block or terminate as expected.
593 \fBSCHED_FIFO\fP ¤ä \fBSCHED_RR\fP ¤Ç¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤µ¤ì¤ë
594 ¥×¥í¥»¥¹¤¬Ää»ß¤»¤º¤Ë̵¸Â¥ë¡¼¥×¤Ë´Ù¤ë¤È¡¢
595 ¾¤ÎÁ´¤Æ¤Î¤è¤êÄ㤤ͥÀèÅÙ¤Î¥×¥í¥»¥¹¤ò±Êµ×¤ËÄä»ß (block) ¤µ¤»¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢
596 ¥½¥Õ¥È¥¦¥§¥¢³«È¯¼Ô¤Ï¥³¥ó¥½¡¼¥ë¤Î¥·¥§¥ë¤ÎÀÅŪͥÀèÅÙ¤ò¥Æ¥¹¥È¤¹¤ë
597 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤è¤ê¤â¾ï¤Ë¹â¤¯ÊݤĤ٤­¤Ç¤¢¤ë¡£
598 ¤³¤ì¤Ë¤è¤Ã¤Æ´üÂÔÄ̤ê¤ËÄä»ß¤·¤¿¤ê½ªÎ»¤·¤¿¤ê¤·¤Ê¤¤¥ê¥¢¥ë¥¿¥¤¥à¡¦
599 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¶ÛµÞ½ªÎ»¤µ¤»¤ë¤³¤È¤¬²Äǽ¤Ë¤Ê¤ë¡£
600 .\"O See also the description of the
601 .\"O .BR RLIMIT_RTTIME
602 .\"O resource limit in
603 .\"O .BR getrlimit (2).
604 .BR getrlimit (2)
605 ¤Î¥ê¥½¡¼¥¹À©¸Â
606 .B RLIMIT_RTTIME
607 ¤ÎÀâÌÀ¤â»²¾È¤Î¤³¤È¡£
608
609 .\"O POSIX systems on which
610 .\"O .BR sched_setscheduler ()
611 .\"O and
612 .\"O .BR sched_getscheduler ()
613 .\"O are available define
614 .\"O .B _POSIX_PRIORITY_SCHEDULING
615 .\"O in \fI<unistd.h>\fP.
616 POSIX ¥·¥¹¥Æ¥à¤Ç¤Ï \fI<unistd.h>\fP ¤Ë
617 .B _POSIX_PRIORITY_SCHEDULING
618 ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Î¤ß
619 .BR sched_setscheduler ()
620 ¤È
621 .BR sched_getscheduler ()
622 ¤¬»ÈÍѤǤ­¤ë¡£
623 .\"O .SH "RETURN VALUE"
624 .SH ÊÖ¤êÃÍ
625 .\"O On success,
626 .\"O .BR sched_setscheduler ()
627 .\"O returns zero.
628 .\"O On success,
629 .\"O .BR sched_getscheduler ()
630 .\"O returns the policy for the process (a nonnegative integer).
631 .\"O On error, \-1 is returned, and
632 .\"O .I errno
633 .\"O is set appropriately.
634 À®¸ù¤·¤¿¾ì¹ç¡¢
635 .BR sched_setscheduler ()
636 ¤Ï 0 ¤òÊÖ¤¹¡£
637 À®¸ù¤·¤¿¾ì¹ç¡¢
638 .BR sched_getscheduler ()
639 ¤Ï¸½ºß¤Î¤½¤Î¥×¥í¥»¥¹¤Î¥Ý¥ê¥·¡¼ (ÈóÉé¤ÎÀ°¿ô) ¤òÊÖ¤¹¡£
640 ¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤¬ÊÖ¤µ¤ì¡¢
641 .I errno
642 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
643 .\"O .SH ERRORS
644 .SH ¥¨¥é¡¼
645 .TP
646 .B EINVAL
647 .\"O The scheduling \fIpolicy\fP is not one of the recognized policies,
648 .\"O or \fIparam\fP does not make sense for the \fIpolicy\fP.
649 ¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼ \fIpolicy\fP ¤¬´Ö°ã¤Ã¤Æ¤¤¤ë¤«¡¢
650 \fIparam\fP ¤¬¤½¤Î¥Ý¥ê¥·¡¼¤Ç¤Ï°ÕÌ£¤ò¤Ê¤µ¤Ê¤¤¡£
651 .TP
652 .B EPERM
653 .\"O The calling process does not have appropriate privileges.
654 ¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤¬Å¬ÀÚ¤ÊÆø¢¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
655 .TP
656 .B ESRCH
657 .\"O The process whose ID is \fIpid\fP could not be found.
658 ID¤¬ \fIpid\fP ¤Î¥×¥í¥»¥¹¤¬¸«¤Ä¤«¤é¤Ê¤¤¡£
659 .\"O .SH "CONFORMING TO"
660 .SH ½àµò
661 .\"O POSIX.1-2001 (but see BUGS below).
662 .\"O The \fBSCHED_BATCH\fP and \fBSCHED_IDLE\fP policies are Linux-specific.
663 POSIX.1-2001 (⤷¡¢²¼µ­¤Î¥Ð¥°¤ÎÀá¤â»²¾È)¡£
664 \fBSCHED_BATCH\fP ¤È \fBSCHED_IDLE\fP ¥Ý¥ê¥·¡¼¤Ï Linux ¸ÇÍ­¤Ç¤¢¤ë¡£
665 .\"O .SH NOTES
666 .SH Ãí°Õ
667 .\"O POSIX.1 does not detail the permissions that an unprivileged
668 .\"O process requires in order to call
669 .\"O .BR sched_setscheduler (),
670 .\"O and details vary across systems.
671 .\"O For example, the Solaris 7 manual page says that
672 .\"O the real or effective user ID of the calling process must
673 .\"O match the real user ID or the save set-user-ID of the target process.
674 POSIX.1 ¤Ï¡¢ÈóÆø¢¥×¥í¥»¥¹¤¬
675 .BR sched_setscheduler ()
676 ¤ò¸Æ¤Ó½Ð¤¹¤¿¤á¤ËɬÍפʸ¢¸Â¤Î¾ÜºÙ¤òµ¬Äꤷ¤Æ¤ª¤é¤º¡¢
677 ¾ÜºÙ¤Ï¥·¥¹¥Æ¥à¤Ë¤è¤ê°Û¤Ê¤ë¡£
678 Î㤨¤Ð¡¢Solaris 7 ¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ç¤Ï¡¢
679 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¼Â¥æ¡¼¥¶ ID ¤Þ¤¿¤Ï¼Â¸ú¥æ¡¼¥¶ ID ¤¬
680 ÀßÄêÂÐ¾Ý¤Î¥×¥í¥»¥¹¤Î¼Â¥æ¡¼¥¶ ID ¤«Êݸ (save) set-user-ID ¤È
681 °ìÃפ·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡¢¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
682 .PP
683 .\"O Originally, Standard Linux was intended as a general-purpose operating
684 .\"O system being able to handle background processes, interactive
685 .\"O applications, and less demanding real-time applications (applications that
686 .\"O need to usually meet timing deadlines).
687 ¤â¤È¤â¤È¤Ï¡¢É¸½à¤Î Linux ¤Ï°ìÈÌÌÜŪ¤Î¥ª¥Ú¥ì¡¼¥Æ¥£¥ó¥°¥·¥¹¥Æ¥à¤È¤·¤Æ
688 À߷פµ¤ì¤Æ¤ª¤ê¡¢¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¡¦¥×¥í¥»¥¹¤äÂÐÏÃŪ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¡¢
689 ¥ê¥¢¥ë¥¿¥¤¥àÀ­¤ÎÍ׵᤬¸·¤·¤¯¤Ê¤¤¥ê¥¢¥ë¥¿¥¤¥à¡¦¥¢¥×¥ê¥±¡¼¥·¥ç¥ó
690 (ÉáÄ̤ϥ¿¥¤¥ß¥ó¥°¤Î±þÅú´ü¸Â (deadline) ¤òËþ¤¿¤¹É¬Íפ¬¤¢¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó)
691 ¤ò°·¤¦¤³¤È¤¬¤Ç¤­¤¿¡£
692 .\"O Although the Linux kernel 2.6
693 .\"O allowed for kernel preemption and the newly introduced O(1) scheduler
694 .\"O ensures that the time needed to schedule is fixed and deterministic
695 .\"O irrespective of the number of active tasks, true real-time computing
696 .\"O was not possible up to kernel version 2.6.17.
697 Linux ¥«¡¼¥Í¥ë 2.6 ¤Ç¤Ï¡¢
698 ¥«¡¼¥Í¥ë¤Î¥×¥ê¥¨¥ó¥×¥·¥ç¥ó (¥¿¥¹¥¯¤ÎÃÖ¤­´¹¤¨) ¤¬²Äǽ¤Ç¤¢¤ê¡¢
699 ¿·¤¿¤ËƳÆþ¤µ¤ì¤¿ O(1) ¥¹¥±¥¸¥å¡¼¥é¤Ë¤è¤ê¡¢
700 ¥¢¥¯¥Æ¥£¥Ö¤Ê¥¿¥¹¥¯¤Î¿ô¤Ë´Ø¤ï¤é¤º¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤ËɬÍפʻþ´Ö¤Ï
701 ¸ÇÄê¤Ç³ÎÄêŪ (deterministic) ¤Ç¤¢¤ë¤³¤È¤¬Êݾڤµ¤ì¤Æ¤¤¤ë¡£
702 ¤½¤ì¤Ë¤â´Ø¤ï¤é¤º¡¢¥«¡¼¥Í¥ë 2.6.17 ¤Þ¤Ç¤Ï
703 ¿¿¤Î¥ê¥¢¥ë¥¿¥¤¥à¡¦¥³¥ó¥Ô¥å¡¼¥Æ¥£¥ó¥°¤Ï¼Â¸½¤Ç¤­¤Ê¤«¤Ã¤¿¡£
704 .\"O .SS Real-time features in the mainline Linux kernel
705 .SS ËÜή¤Î Linux ¥«¡¼¥Í¥ë¤Ç¤Î¥ê¥¢¥ë¥¿¥¤¥àµ¡Ç½
706 .\" FIXME . Probably this text will need some minor tweaking
707 .\" by about the time of 2.6.30; ask Carsten Emde about this then.
708 .\"O From kernel version 2.6.18 onwards, however, Linux is gradually
709 .\"O becoming equipped with real-time capabilities,
710 .\"O most of which are derived from the former
711 .\"O .I realtime-preempt
712 .\"O patches developed by Ingo Molnar, Thomas Gleixner,
713 .\"O Steven Rostedt, and others.
714 .\"O Until the patches have been completely merged into the
715 .\"O mainline kernel
716 .\"O (this is expected to be around kernel version 2.6.30),
717 .\"O they must be installed to achieve the best real-time performance.
718 ¥«¡¼¥Í¥ë 2.6.18 ¤«¤é¸½ºß¤Þ¤Ç¡¢
719 Linux ¤Ï½ù¡¹¤Ë¥ê¥¢¥ë¥¿¥¤¥àµ¡Ç½¤òÈ÷¤¨¤Ä¤Ä¤¢¤ë¤¬¡¢
720 ¤³¤ì¤é¤Îµ¡Ç½¤Î¤Û¤È¤ó¤É¤Ï¡¢
721 Ingo Molnar, Thomas Gleixner, Steven Rostedt ¤é¤Ë¤è¤Ã¤Æ³«È¯¤µ¤ì¤¿¡¢
722 °ÊÁ°¤Î
723 .I realtime-preempt
724 ¥Ñ¥Ã¥Á¤«¤é¤Î¤â¤Î¤Ç¤¢¤ë¡£
725 ¤³¤ì¤é¤Î¥Ñ¥Ã¥Á¤¬ËÜή¤Î¥«¡¼¥Í¥ë¤Ë´°Á´¤Ë¥Þ¡¼¥¸¤µ¤ì¤ë¤Þ¤Ç¤Ï
726 (¥Þ¡¼¥¸¤Î´°Î»¤Ï¥«¡¼¥Í¥ë 2.6.30 ¤¢¤¿¤ê¤ÎͽÄê)¡¢
727 ºÇ¹â¤Î¥ê¥¢¥ë¥¿¥¤¥àÀ­Ç½¤òãÀ®¤¹¤ë¤Ë¤Ï realtime-preempt ¥Ñ¥Ã¥Á¤ò
728 ÁȤ߹þ¤Þ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
729 .\"O These patches are named:
730 ¤³¤ì¤é¤Î¥Ñ¥Ã¥Á¤Ï
731 .in +4n
732 .nf
733
734 patch-\fIkernelversion\fP-rt\fIpatchversion\fP
735 .fi
736 .in
737 .\"O .PP
738 .\"O and can be downloaded from
739 .\"O .IR http://www.kernel.org/pub/linux/kernel/projects/rt/ .
740 ¤È¤¤¤¦Ì¾Á°¤Ç¡¢
741 .I http://www.kernel.org/pub/linux/kernel/projects/rt/
742 ¤«¤é¥À¥¦¥ó¥í¡¼¥É¤Ç¤­¤ë¡£
743
744 .\"O Without the patches and prior to their full inclusion into the mainline
745 .\"O kernel, the kernel configuration offers only the three preemption classes
746 .\"O .BR CONFIG_PREEMPT_NONE ,
747 .\"O .BR CONFIG_PREEMPT_VOLUNTARY ,
748 .\"O and
749 .\"O .B CONFIG_PREEMPT_DESKTOP
750 .\"O which respectively provide no, some, and considerable
751 .\"O reduction of the worst-case scheduling latency.
752 ¤³¤Î¥Ñ¥Ã¥Á¤¬Å¬ÍѤµ¤ì¤º¡¢¤«¤Ä¥Ñ¥Ã¥Á¤ÎÆâÍƤÎËÜή¤Î¥«¡¼¥Í¥ë¤Ø¤Î¥Þ¡¼¥¸¤¬
753 ´°Î»¤¹¤ë¤Þ¤Ç¤Ï¡¢¥«¡¼¥Í¥ë¤ÎÀßÄê¤Ç¤Ï
754 .BR CONFIG_PREEMPT_NONE ,
755 .BR CONFIG_PREEMPT_VOLUNTARY ,
756 .B CONFIG_PREEMPT_DESKTOP
757 ¤Î 3¤Ä¤Î¥×¥ê¥¨¥ó¥×¥·¥ç¥ó¡¦¥¯¥é¥¹ (preemption class) ¤À¤±¤¬Ä󶡤µ¤ì¤ë¡£
758 ¤³¤ì¤é¤Î¥¯¥é¥¹¤Ç¤Ï¡¢ºÇ°­¤Î¾ì¹ç¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°Ãٱ䤬¤½¤ì¤¾¤ì
759 Á´¤¯¸º¤é¤Ê¤¤¡¢¤¤¤¯¤é¤«¸º¤ë¡¢¤«¤Ê¤ê¸º¤ë¡£
760
761 .\"O With the patches applied or after their full inclusion into the mainline
762 .\"O kernel, the additional configuration item
763 .\"O .B CONFIG_PREEMPT_RT
764 .\"O becomes available.
765 .\"O If this is selected, Linux is transformed into a regular
766 .\"O real-time operating system.
767 ¥Ñ¥Ã¥Á¤¬Å¬ÍѤµ¤ì¤¿¾ì¹ç¡¢¤Þ¤¿¤Ï¥Ñ¥Ã¥Á¤ÎÆâÍƤÎËÜή¤Î¥«¡¼¥Í¥ë¤Ø¤Î¥Þ¡¼¥¸¤¬
768 ´°Î»¤·¤¿¸å¤Ç¤Ï¡¢¾åµ­¤Ë²Ã¤¨¤ÆÀßÄê¹àÌܤȤ·¤Æ
769 .B CONFIG_PREEMPT_RT
770 ¤¬ÍøÍѲÄǽ¤Ë¤Ê¤ë¡£¤³¤Î¹àÌܤòÁªÂò¤¹¤ë¤È¡¢
771 Linux ¤ÏÄ̾ï¤Î¥ê¥¢¥ë¥¿¥¤¥à¡¦¥ª¥Ú¥ì¡¼¥Æ¥£¥ó¥°¥·¥¹¥Æ¥à¤ËÊѿȤ¹¤ë¡£
772 .\"O The FIFO and RR scheduling policies that can be selected using
773 .\"O .BR sched_setscheduler ()
774 .\"O are then used to run a process
775 .\"O with true real-time priority and a minimum worst-case scheduling latency.
776 ¤³¤Î¾ì¹ç¤Ë¤Ï¡¢
777 .BR sched_setscheduler ()
778 ¤ÇÁªÂò¤Ç¤­¤ë FIFO ¤È RR ¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤Ï¡¢
779 ¿¿¤Î¥ê¥¢¥ë¥¿¥¤¥àÍ¥ÀèÅÙ¤ò»ý¤Ä¥×¥í¥»¥¹¤òºÇ°­¤Î¾ì¹ç¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°Ãٱ䤬
780 ºÇ¾®¤È¤Ê¤ë´Ä¶­¤ÇÆ°ºî¤µ¤»¤ë¤¿¤á¤Ë»È¤ï¤ì¤ë¤³¤È¤Ë¤Ê¤ë¡£
781 .\"O .SH BUGS
782 .SH ¥Ð¥°
783 .\"O POSIX says that on success,
784 .\"O .BR sched_setscheduler ()
785 .\"O should return the previous scheduling policy.
786 .\"O Linux
787 .\"O .BR sched_setscheduler ()
788 .\"O does not conform to this requirement,
789 .\"O since it always returns 0 on success.
790 POSIX ¤Ç¤Ï¡¢À®¸ù»þ¤Ë
791 .BR sched_setscheduler ()
792 ¤ÏľÁ°¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¡¦¥Ý¥ê¥·¡¼¤òÊÖ¤¹¤Ù¤­¤È¤µ¤ì¤Æ¤¤¤ë¡£
793 Linux ¤Î
794 .BR sched_setscheduler ()
795 ¤Ï¤³¤ÎÍ×µá»ÅÍͤ˽àµò¤·¤Æ¤ª¤é¤º¡¢
796 À®¸ù»þ¤Ë¤Ï¾ï¤Ë 0 ¤òÊÖ¤¹¡£
797 .\"O .SH "SEE ALSO"
798 .SH ´ØÏ¢¹àÌÜ
799 .BR getpriority (2),
800 .BR mlock (2),
801 .BR mlockall (2),
802 .BR munlock (2),
803 .BR munlockall (2),
804 .BR nice (2),
805 .BR sched_get_priority_max (2),
806 .BR sched_get_priority_min (2),
807 .BR sched_getaffinity (2),
808 .BR sched_getparam (2),
809 .BR sched_rr_get_interval (2),
810 .BR sched_setaffinity (2),
811 .BR sched_setparam (2),
812 .BR sched_yield (2),
813 .BR setpriority (2),
814 .BR capabilities (7),
815 .BR cpuset (7)
816 .PP
817 .I Programming for the real world \- POSIX.4
818 by Bill O. Gallmeister, O'Reilly & Associates, Inc., ISBN 1-56592-074-0
819 .PP
820 .\"O The kernel source file
821 .\"O .I Documentation/scheduler/sched-rt-group.txt
822 .\"O (since kernel 2.6.25).
823 ¥«¡¼¥Í¥ë¡¦¥½¡¼¥¹Æâ¤Î¥Õ¥¡¥¤¥ë
824 .I Documentation/scheduler/sched-rt-group.txt
825 (¥«¡¼¥Í¥ë 2.6.25 °Ê¹ß)