OSDN Git Service

(split) LDP: Release pages for LDP v3.39.
[linuxjm/LDP_man-pages.git] / release / man2 / sched_yield.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996
4 .\"
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, write to the Free
22 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" USA.
24 .\"
25 .\" 1996-04-01 Tom Bjorkholm <tomb@mydata.se>
26 .\"            First version written
27 .\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
28 .\"            revision
29 .\"
30 .\"*******************************************************************
31 .\"
32 .\" This file was generated with po4a. Translate the source file.
33 .\"
34 .\"*******************************************************************
35 .TH SCHED_YIELD 2 2008\-10\-18 Linux "Linux Programmer's Manual"
36 .SH 名前
37 sched_yield \- プロセッサーを空け渡す(yield)
38 .SH 書式
39 \fB#include <sched.h>\fP
40 .sp
41 \fBint sched_yield(void);\fP
42 .SH 説明
43 \fBsched_yield\fP()  を呼び出すことで、呼び出したスレッドが CPU の使用権を手放すことができる。
44 そのスレッドは、そのスレッドの静的プライオリティのキューの末尾に 移動し、新しいスレッドが走り始める。
45 .SH 返り値
46 成功した場合は \fBsched_yield\fP()  は 0 を返す。 エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
47 .SH エラー
48 Linux の実装では、 \fBsched_yield\fP()  は常に成功する。
49 .SH 準拠
50 POSIX.1\-2001.
51 .SH 注意
52 \fBsched_yield\fP()  を呼び出した時点で最大優先度のリストの中に呼び出し元のスレッドしか
53 存在しなければ、そのスレッドは呼び出し後も走り続けることになる。
54
55 POSIX システムで \fBsched_yield\fP()  は \fI<unistd.h>\fP に
56 \fB_POSIX_PRIORITY_SCHEDULING\fP が定義されている場合にのみ使用可能である。
57
58 \fBsched_yield\fP()  を戦略的に呼び出すことで、(極度に) 競合するリソース (mutex など)
59 を呼び出し元が解放した際に他のスレッドやプロセスに実行機会を与えることで、 性能を上げることができる。 \fBsched_yield\fP()
60 を必要もないのに呼び出したり、不適切な場面 (例えば、他のスケジューリング 対象となるスレッドが必要とするリソースを呼び出し元が保持したままの状態)
61 で呼び出したりするのは避けること。なぜなら、 \fBsched_yield\fP()  の呼び出しより不必要なコンテキストスイッチが起こり、システム性能が
62 劣化する結果になるからである。
63 .SH 関連項目
64 Linux のスケージュリング(scheduling)については \fBsched_setscheduler\fP(2)  を参照せよ。
65 .PP
66 \fIProgramming for the real world \- POSIX.4\fP by Bill O. Gallmeister, O'Reilly
67 & Associates, Inc., ISBN 1\-56592\-074\-0