.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996 .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, .\" USA. .\" .\" 1996-04-01 Tom Bjorkholm .\" First version written .\" 1996-04-10 Markus Kuhn .\" revision .\" .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya .\" all rights reserved. .\" Translated 1997-02-23, HANATAKA Shinya .\" Updated 2003-10-11, Kentaro Shirakata .\" Updated 2007-05-28, Akihiro MOTOKI , LDP v2.48 .\" .\"WORD: interval 間隔 .\"WORD: round robin ラウンド・ロビン .\"WORD: process プロセス .\"WORD: scheduling スケジューリング .\"WORD: policy 方針 .\"WORD: implement 実装 .\" .TH SCHED_RR_GET_INTERVAL 2 2007-04-06 "Linux" "Linux Programmer's Manual" .SH 名前 sched_rr_get_interval \- 指定されたプロセスの SCHED_RR 間隔を取得する .SH 書式 .B #include .sp .BI "int sched_rr_get_interval(pid_t " pid ", struct timespec *" tp ); .SH 説明 .BR sched_rr_get_interval () は \fItp\fP で指定された \fItimespec\fP 構造体に \fIpid\fP で指定されたプロセスのラウンド・ロビン時間量 (round robin time quantum) を書き込む。 \fItimespec\fP 構造体は以下の通りである: .in +4n .nf struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; .fi .in \fIpid\fP がゼロの場合、呼び出したプロセスの時間量が \fI*tp\fP に書き込まれる。指定したプロセスは .B SCHED_RR スケジューリング方針で稼動している必要がある。 .\" FIXME . On Linux, sched_rr_get_interval() .\" returns the timeslice for SCHED_OTHER processes -- this timeslice .\" is influenced by the nice value. .\" For SCHED_FIFO processes, this always returns 0. .\" .\" ラウンド・ロビン時間量は Linux 1.3.81 では変更できない。 .\" .BR sched_rr_get_interval () の使用可能な POSIX システムでは .I で .B _POSIX_PRIORITY_SCHEDULING が定義されている。 .SH 返り値 成功した場合は .BR sched_rr_get_interval () は 0 を返す。 エラーの場合は \-1 が返され、 .I errno が適切に設定される。 .SH エラー .TP .B EFAULT 情報をユーザ空間にコピーする時に問題が起きた。 .TP .B EINVAL PID が不正である。 .TP .B ENOSYS システム・コールがまだ実装されていない (かなり古いカーネルにおいてのみ)。 .TP .B ESRCH \fIpid\fP の ID を持つプロセスが見つからなかった。 .SH 準拠 POSIX.1-2001. .SH 注意 .SS Linux での注意 .\" FIXME .\" From at least Linux 2.6.9, the following is no longer true .\" for SCHED_RR processes. For RR processes the timeslice is always .\" DEF_TIMESLICE, or 0.1 secs. .\" Was the following really true for older kernels? .\" Must build a 2.6.8 kernel and retest, and rewrite the following text .\" appropriately. POSIX ではラウンド・ロビン時間量の大きさを制御する仕組みが規定されていない。 しかし、Linux ではこれを変更する方法が提供されており (この方法に移植性はない)、 プロセスの nice 値を調整することで時間量を制御できる .RB ( setpriority (2) 参照)。 負の nice 値 (すなわち、高い nice 値) を割り当てると時間量は長くなり、 正の nice 値 (すなわち、低い nice 値) を割り当てると時間量は短くなる。 デフォルトの時間量は 0.1 秒である。 nice 値の変更が時間量にどの程度影響を与えるかは カーネルのバージョンにより多少異なる。 .\" .SH バグ .\" Linux 1.3.81 の時点では .\" .BR sched_rr_get_interval () .\" は ENOSYS エラーを返す。 .\" これは SCHED_RR はまだ完全には実装されておらず、 .\" 適切にテストされていないからである。 .SH 関連項目 .BR sched_setscheduler (2) に Linux のスケジューリング方式についての説明がある。 .PP .I Programming for the real world \- POSIX.4 by Bill O. Gallmeister, O'Reilly & Associates, Inc., ISBN 1-56592-074-0