1SCHED_RR_GET_INTERVAL(2) Linux Programmer's Manual SCHED_RR_GET_INTERVAL(2)
2
3
4
6 sched_rr_get_interval - get the SCHED_RR interval for the named process
7
9 #include <sched.h>
10
11 int sched_rr_get_interval(pid_t pid, struct timespec * tp);
12
14 sched_rr_get_interval() writes into the timespec structure pointed to
15 by tp the round-robin time quantum for the process identified by pid.
16 The specified process should be running under the SCHED_RR scheduling
17 policy.
18
19 The timespec structure has the following form:
20
21 struct timespec {
22 time_t tv_sec; /* seconds */
23 long tv_nsec; /* nanoseconds */
24 };
25
26 If pid is zero, the time quantum for the calling process is written
27 into *tp.
28
30 On success, sched_rr_get_interval() returns 0. On error, -1 is
31 returned, and errno is set appropriately.
32
34 EFAULT Problem with copying information to user space.
35
36 EINVAL Invalid pid.
37
38 ENOSYS The system call is not yet implemented (only on rather old ker‐
39 nels).
40
41 ESRCH Could not find a process with the ID pid.
42
44 POSIX.1-2001.
45
47 POSIX systems on which sched_rr_get_interval() is available define
48 _POSIX_PRIORITY_SCHEDULING in <unistd.h>.
49
50 Linux notes
51 POSIX does not specify any mechanism for controlling the size of the
52 round-robin time quantum. Older Linux kernels provide a (nonportable)
53 method of doing this. The quantum can be controlled by adjusting the
54 process's nice value (see setpriority(2)). Assigning a negative (i.e.,
55 high) nice value results in a longer quantum; assigning a positive
56 (i.e., low) nice value results in a shorter quantum. The default quan‐
57 tum is 0.1 seconds; the degree to which changing the nice value affects
58 the quantum has varied somewhat across kernel versions. This method of
59 adjusting the quantum was removed starting with Linux 2.6.24.
60
61 Linux 3.9 added a new mechanism for adjusting (and viewing) the
62 SCHED_RR quantum: the /proc/sys/kernel/sched_rr_timeslice_ms file
63 exposes the quantum as a millisecond value, whose default is 100.
64 Writing 0 to this file resets the quantum to the default value.
65
67 sched_setscheduler(2) has a description of the Linux scheduling scheme.
68
69 Programming for the real world - POSIX.4 by Bill O. Gallmeister,
70 O'Reilly & Associates, Inc., ISBN 1-56592-074-0.
71
73 This page is part of release 3.53 of the Linux man-pages project. A
74 description of the project, and information about reporting bugs, can
75 be found at http://www.kernel.org/doc/man-pages/.
76
77
78
79Linux 2013-03-18 SCHED_RR_GET_INTERVAL(2)