sched.7: spfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2014-05-10 07:22:47 +02:00
parent 81e10454a2
commit 005eaa8f76
1 changed files with 31 additions and 21 deletions

View File

@ -70,12 +70,12 @@ Set the CPU affinity of a specified thread.
.TP .TP
.BR sched_setattr (2) .BR sched_setattr (2)
(Linux-specific) (Linux-specific)
A generaized API for setting the scheduling policy and parameters A generalized API for setting the scheduling policy and parameters
of a specified thread. of a specified thread.
.TP .TP
.BR sched_getattr (2) .BR sched_getattr (2)
(Linux-specific) (Linux-specific)
A generaized API for fetching the scheduling policy and parameters A generalized API for fetching the scheduling policy and parameters
of a specified thread. of a specified thread.
.\" .\"
.SS Scheduling policies .SS Scheduling policies
@ -238,25 +238,42 @@ or
policies). policies).
.\" .\"
.SS Resetting scheduling policy for child processes .SS Resetting scheduling policy for child processes
Since Linux 2.6.32, the Each thread has a reset-on-fork scheduling flag.
.B SCHED_RESET_ON_FORK When this flag is set, children created by
flag can be ORed in
.I policy
when calling
.BR sched_setscheduler ().
As a result of including this flag, children created by
.BR fork (2) .BR fork (2)
do not inherit privileged scheduling policies. do not inherit privileged scheduling policies.
This feature is intended for media-playback applications, The reset-on-fork flag can be set by either:
.IP * 3
ORing the
.B SCHED_RESET_ON_FORK
flag into the
.I policy
argument when calling
.BR sched_setscheduler (2)
(since Linux 2.6.32);
or
.IP *
specifying the
.B SCHED_FLAG_RESET_ON_FORK
flag in
.IR attr.sched_flags
when calling
.BR sched_setattr (2).
.PP
Note that the constants used with these two APIs have different names.
The state of the reset-on-fork flag can analogously be retrieved using
.BR sched_getscheduler (2)
and
.BR sched_getattr (2).
The reset-on-fork feature is intended for media-playback applications,
and can be used to prevent applications evading the and can be used to prevent applications evading the
.BR RLIMIT_RTTIME .BR RLIMIT_RTTIME
resource limit (see resource limit (see
.BR getrlimit (2)) .BR getrlimit (2))
by creating multiple child processes. by creating multiple child processes.
More precisely, if the More precisely, if the reset-on-fork flag is set,
.BR SCHED_RESET_ON_FORK
flag is specified,
the following rules apply for subsequently created children: the following rules apply for subsequently created children:
.IP * 3 .IP * 3
If the calling thread has a scheduling policy of If the calling thread has a scheduling policy of
@ -270,19 +287,12 @@ in child processes.
If the calling process has a negative nice value, If the calling process has a negative nice value,
the nice value is reset to zero in child processes. the nice value is reset to zero in child processes.
.PP .PP
After the After the reset-on-fork flag has been enabled,
.BR SCHED_RESET_ON_FORK
flag has been enabled,
it can be reset only if the thread has the it can be reset only if the thread has the
.BR CAP_SYS_NICE .BR CAP_SYS_NICE
capability. capability.
This flag is disabled in child processes created by This flag is disabled in child processes created by
.BR fork (2). .BR fork (2).
The
.B SCHED_RESET_ON_FORK
flag is visible in the policy value returned by
.BR sched_getscheduler ()
.\" .\"
.SS Privileges and resource limits .SS Privileges and resource limits
In Linux kernels before 2.6.12, only privileged In Linux kernels before 2.6.12, only privileged