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 re‐
31 turned, and errno is set to indicate the error.
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, POSIX.1-2008.
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 ex‐
63 poses the quantum as a millisecond value, whose default is 100. Writ‐
64 ing 0 to this file resets the quantum to the default value.
65
67 sched(7)
68
70 This page is part of release 5.12 of the Linux man-pages project. A
71 description of the project, information about reporting bugs, and the
72 latest version of this page, can be found at
73 https://www.kernel.org/doc/man-pages/.
74
75
76
77Linux 2021-03-22 SCHED_RR_GET_INTERVAL(2)