|
Packit |
7cfc04 |
.\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
|
|
Packit |
7cfc04 |
.\" This is free documentation; you can redistribute it and/or
|
|
Packit |
7cfc04 |
.\" modify it under the terms of the GNU General Public License as
|
|
Packit |
7cfc04 |
.\" published by the Free Software Foundation; either version 2 of
|
|
Packit |
7cfc04 |
.\" the License, or (at your option) any later version.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" The GNU General Public License's references to "object code"
|
|
Packit |
7cfc04 |
.\" and "executables" are to be interpreted as the output of any
|
|
Packit |
7cfc04 |
.\" document formatting or typesetting system, including
|
|
Packit |
7cfc04 |
.\" intermediate and printed output.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" This manual is distributed in the hope that it will be useful,
|
|
Packit |
7cfc04 |
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
7cfc04 |
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
7cfc04 |
.\" GNU General Public License for more details.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" You should have received a copy of the GNU General Public
|
|
Packit |
7cfc04 |
.\" License along with this manual; if not, see
|
|
Packit |
7cfc04 |
.\" <http://www.gnu.org/licenses/>.
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_END
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" 1996-04-01 Tom Bjorkholm <tomb@mydata.se>
|
|
Packit |
7cfc04 |
.\" First version written
|
|
Packit |
7cfc04 |
.\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
|
|
Packit |
7cfc04 |
.\" revision
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.TH SCHED_RR_GET_INTERVAL 2 2017-09-15 "Linux" "Linux Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
sched_rr_get_interval \- get the SCHED_RR interval for the named process
|
|
Packit |
7cfc04 |
.SH SYNOPSIS
|
|
Packit |
7cfc04 |
.B #include <sched.h>
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.BI "int sched_rr_get_interval(pid_t " pid ", struct timespec *" tp );
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
.BR sched_rr_get_interval ()
|
|
Packit |
7cfc04 |
writes into the
|
|
Packit |
7cfc04 |
.I timespec
|
|
Packit |
7cfc04 |
structure pointed to by
|
|
Packit |
7cfc04 |
.I tp
|
|
Packit |
7cfc04 |
the round-robin time quantum for the process identified by
|
|
Packit |
7cfc04 |
.IR pid .
|
|
Packit |
7cfc04 |
The specified process should be running under the
|
|
Packit |
7cfc04 |
.B SCHED_RR
|
|
Packit |
7cfc04 |
scheduling policy.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.I timespec
|
|
Packit |
7cfc04 |
structure has the following form:
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.in +4n
|
|
Packit |
7cfc04 |
.EX
|
|
Packit |
7cfc04 |
struct timespec {
|
|
Packit |
7cfc04 |
time_t tv_sec; /* seconds */
|
|
Packit |
7cfc04 |
long tv_nsec; /* nanoseconds */
|
|
Packit |
7cfc04 |
};
|
|
Packit |
7cfc04 |
.EE
|
|
Packit |
7cfc04 |
.in
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.I pid
|
|
Packit |
7cfc04 |
is zero, the time quantum for the calling process is written into
|
|
Packit |
7cfc04 |
.IR *tp .
|
|
Packit |
7cfc04 |
.\" FIXME . On Linux, sched_rr_get_interval()
|
|
Packit |
7cfc04 |
.\" returns the timeslice for SCHED_OTHER processes -- this timeslice
|
|
Packit |
7cfc04 |
.\" is influenced by the nice value.
|
|
Packit |
7cfc04 |
.\" For SCHED_FIFO processes, this always returns 0.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" The round-robin time quantum value is not alterable under Linux
|
|
Packit |
7cfc04 |
.\" 1.3.81.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.SH RETURN VALUE
|
|
Packit |
7cfc04 |
On success,
|
|
Packit |
7cfc04 |
.BR sched_rr_get_interval ()
|
|
Packit |
7cfc04 |
returns 0.
|
|
Packit |
7cfc04 |
On error, \-1 is returned, and
|
|
Packit |
7cfc04 |
.I errno
|
|
Packit |
7cfc04 |
is set appropriately.
|
|
Packit |
7cfc04 |
.SH ERRORS
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B EFAULT
|
|
Packit |
7cfc04 |
Problem with copying information to user space.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B EINVAL
|
|
Packit |
7cfc04 |
Invalid pid.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B ENOSYS
|
|
Packit |
7cfc04 |
The system call is not yet implemented (only on rather old kernels).
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B ESRCH
|
|
Packit |
7cfc04 |
Could not find a process with the ID
|
|
Packit |
7cfc04 |
.IR pid .
|
|
Packit |
7cfc04 |
.SH CONFORMING TO
|
|
Packit |
7cfc04 |
POSIX.1-2001, POSIX.1-2008.
|
|
Packit |
7cfc04 |
.SH NOTES
|
|
Packit |
7cfc04 |
POSIX systems on which
|
|
Packit |
7cfc04 |
.BR sched_rr_get_interval ()
|
|
Packit |
7cfc04 |
is available define
|
|
Packit |
7cfc04 |
.B _POSIX_PRIORITY_SCHEDULING
|
|
Packit |
7cfc04 |
in
|
|
Packit |
7cfc04 |
.IR <unistd.h> .
|
|
Packit |
7cfc04 |
.SS Linux notes
|
|
Packit |
7cfc04 |
POSIX does not specify any mechanism for controlling the size of the
|
|
Packit |
7cfc04 |
round-robin time quantum.
|
|
Packit |
7cfc04 |
Older Linux kernels provide a (nonportable) method of doing this.
|
|
Packit |
7cfc04 |
The quantum can be controlled by adjusting the process's nice value (see
|
|
Packit |
7cfc04 |
.BR setpriority (2)).
|
|
Packit |
7cfc04 |
Assigning a negative (i.e., high) nice value results in a longer quantum;
|
|
Packit |
7cfc04 |
assigning a positive (i.e., low) nice value results in a shorter quantum.
|
|
Packit |
7cfc04 |
The default quantum is 0.1 seconds;
|
|
Packit |
7cfc04 |
the degree to which changing the nice value affects the
|
|
Packit |
7cfc04 |
quantum has varied somewhat across kernel versions.
|
|
Packit |
7cfc04 |
This method of adjusting the quantum was removed
|
|
Packit |
7cfc04 |
.\" commit a4ec24b48ddef1e93f7578be53270f0b95ad666c
|
|
Packit |
7cfc04 |
starting with Linux 2.6.24.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
Linux 3.9 added
|
|
Packit |
7cfc04 |
.\" commit ce0dbbbb30aee6a835511d5be446462388ba9eee
|
|
Packit |
7cfc04 |
a new mechanism for adjusting (and viewing) the
|
|
Packit |
7cfc04 |
.BR SCHED_RR
|
|
Packit |
7cfc04 |
quantum: the
|
|
Packit |
7cfc04 |
.I /proc/sys/kernel/sched_rr_timeslice_ms
|
|
Packit |
7cfc04 |
file exposes the quantum as a millisecond value, whose default is 100.
|
|
Packit |
7cfc04 |
Writing 0 to this file resets the quantum to the default value.
|
|
Packit |
7cfc04 |
.\" .SH BUGS
|
|
Packit |
7cfc04 |
.\" As of Linux 1.3.81
|
|
Packit |
7cfc04 |
.\" .BR sched_rr_get_interval ()
|
|
Packit |
7cfc04 |
.\" returns with error
|
|
Packit |
7cfc04 |
.\" ENOSYS, because SCHED_RR has not yet been fully implemented and tested
|
|
Packit |
7cfc04 |
.\" properly.
|
|
Packit |
7cfc04 |
.SH SEE ALSO
|
|
Packit |
7cfc04 |
.BR sched (7)
|
|
Packit |
7cfc04 |
.SH COLOPHON
|
|
Packit |
7cfc04 |
This page is part of release 4.15 of the Linux
|
|
Packit |
7cfc04 |
.I man-pages
|
|
Packit |
7cfc04 |
project.
|
|
Packit |
7cfc04 |
A description of the project,
|
|
Packit |
7cfc04 |
information about reporting bugs,
|
|
Packit |
7cfc04 |
and the latest version of this page,
|
|
Packit |
7cfc04 |
can be found at
|
|
Packit |
7cfc04 |
\%https://www.kernel.org/doc/man\-pages/.
|