1357 lines
41 KiB
HTML
1357 lines
41 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SCHED</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SCHED</H1>
|
|
Section: Linux Programmer's Manual (7)<BR>Updated: 2019-08-02<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sched - overview of CPU scheduling
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
Since Linux 2.6.23, the default scheduler is CFS,
|
|
the "Completely Fair Scheduler".
|
|
The CFS scheduler replaced the earlier "<A HREF="/cgi-bin/man/man2html?1+O">O</A>(1)" scheduler.
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H3>API summary</H3>
|
|
|
|
Linux provides the following system calls for controlling
|
|
the CPU scheduling behavior, policy, and priority of processes
|
|
(or, more precisely, threads).
|
|
<DL COMPACT>
|
|
<DT id="1"><B><A HREF="/cgi-bin/man/man2html?2+nice">nice</A></B>(2)
|
|
|
|
<DD>
|
|
Set a new nice value for the calling thread,
|
|
and return the new nice value.
|
|
<DT id="2"><B><A HREF="/cgi-bin/man/man2html?2+getpriority">getpriority</A></B>(2)
|
|
|
|
<DD>
|
|
Return the nice value of a thread, a process group,
|
|
or the set of threads owned by a specified user.
|
|
<DT id="3"><B><A HREF="/cgi-bin/man/man2html?2+setpriority">setpriority</A></B>(2)
|
|
|
|
<DD>
|
|
Set the nice value of a thread, a process group,
|
|
or the set of threads owned by a specified user.
|
|
<DT id="4"><B><A HREF="/cgi-bin/man/man2html?2+sched_setscheduler">sched_setscheduler</A></B>(2)
|
|
|
|
<DD>
|
|
Set the scheduling policy and parameters of a specified thread.
|
|
<DT id="5"><B><A HREF="/cgi-bin/man/man2html?2+sched_getscheduler">sched_getscheduler</A></B>(2)
|
|
|
|
<DD>
|
|
Return the scheduling policy of a specified thread.
|
|
<DT id="6"><B><A HREF="/cgi-bin/man/man2html?2+sched_setparam">sched_setparam</A></B>(2)
|
|
|
|
<DD>
|
|
Set the scheduling parameters of a specified thread.
|
|
<DT id="7"><B><A HREF="/cgi-bin/man/man2html?2+sched_getparam">sched_getparam</A></B>(2)
|
|
|
|
<DD>
|
|
Fetch the scheduling parameters of a specified thread.
|
|
<DT id="8"><B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_max">sched_get_priority_max</A></B>(2)
|
|
|
|
<DD>
|
|
Return the maximum priority available in a specified scheduling policy.
|
|
<DT id="9"><B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_min">sched_get_priority_min</A></B>(2)
|
|
|
|
<DD>
|
|
Return the minimum priority available in a specified scheduling policy.
|
|
<DT id="10"><B><A HREF="/cgi-bin/man/man2html?2+sched_rr_get_interval">sched_rr_get_interval</A></B>(2)
|
|
|
|
<DD>
|
|
Fetch the quantum used for threads that are scheduled under
|
|
the "round-robin" scheduling policy.
|
|
<DT id="11"><B><A HREF="/cgi-bin/man/man2html?2+sched_yield">sched_yield</A></B>(2)
|
|
|
|
<DD>
|
|
Cause the caller to relinquish the CPU,
|
|
so that some other thread be executed.
|
|
<DT id="12"><B><A HREF="/cgi-bin/man/man2html?2+sched_setaffinity">sched_setaffinity</A></B>(2)
|
|
|
|
<DD>
|
|
(Linux-specific)
|
|
Set the CPU affinity of a specified thread.
|
|
<DT id="13"><B><A HREF="/cgi-bin/man/man2html?2+sched_getaffinity">sched_getaffinity</A></B>(2)
|
|
|
|
<DD>
|
|
(Linux-specific)
|
|
Get the CPU affinity of a specified thread.
|
|
<DT id="14"><B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2)
|
|
|
|
<DD>
|
|
Set the scheduling policy and parameters of a specified thread.
|
|
This (Linux-specific) system call provides a superset of the functionality of
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setscheduler">sched_setscheduler</A></B>(2)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setparam">sched_setparam</A></B>(2).
|
|
|
|
<DT id="15"><B><A HREF="/cgi-bin/man/man2html?2+sched_getattr">sched_getattr</A></B>(2)
|
|
|
|
<DD>
|
|
Fetch the scheduling policy and parameters of a specified thread.
|
|
This (Linux-specific) system call provides a superset of the functionality of
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_getscheduler">sched_getscheduler</A></B>(2)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_getparam">sched_getparam</A></B>(2).
|
|
|
|
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H3>Scheduling policies</H3>
|
|
|
|
The scheduler is the kernel component that decides which runnable thread
|
|
will be executed by the CPU next.
|
|
Each thread has an associated scheduling policy and a <I>static</I>
|
|
scheduling priority,
|
|
<I>sched_priority</I>.
|
|
|
|
The scheduler makes its decisions based on knowledge of the scheduling
|
|
policy and static priority of all threads on the system.
|
|
<P>
|
|
|
|
For threads scheduled under one of the normal scheduling policies
|
|
(<B>SCHED_OTHER</B>, <B>SCHED_IDLE</B>, <B>SCHED_BATCH</B>),
|
|
<I>sched_priority</I> is not used in scheduling
|
|
decisions (it must be specified as 0).
|
|
<P>
|
|
|
|
Processes scheduled under one of the real-time policies
|
|
(<B>SCHED_FIFO</B>, <B>SCHED_RR</B>) have a
|
|
<I>sched_priority</I> value in the range 1 (low) to 99 (high).
|
|
(As the numbers imply, real-time threads always have higher priority
|
|
than normal threads.)
|
|
Note well: POSIX.1 requires an implementation to support only a
|
|
minimum 32 distinct priority levels for the real-time policies,
|
|
and some systems supply just this minimum.
|
|
Portable programs should use
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_min">sched_get_priority_min</A></B>(2)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_max">sched_get_priority_max</A></B>(2)
|
|
|
|
to find the range of priorities supported for a particular policy.
|
|
<P>
|
|
|
|
Conceptually, the scheduler maintains a list of runnable
|
|
threads for each possible <I>sched_priority</I> value.
|
|
In order to determine which thread runs next, the scheduler looks for
|
|
the nonempty list with the highest static priority and selects the
|
|
thread at the head of this list.
|
|
<P>
|
|
|
|
A thread's scheduling policy determines
|
|
where it will be inserted into the list of threads
|
|
with equal static priority and how it will move inside this list.
|
|
<P>
|
|
|
|
All scheduling is preemptive: if a thread with a higher static
|
|
priority becomes ready to run, the currently running thread
|
|
will be preempted and
|
|
returned to the wait list for its static priority level.
|
|
The scheduling policy determines the
|
|
ordering only within the list of runnable threads with equal static
|
|
priority.
|
|
<A NAME="lbAF"> </A>
|
|
<H3>SCHED_FIFO: First in-first out scheduling</H3>
|
|
|
|
<B>SCHED_FIFO</B> can be used only with static priorities higher than
|
|
0, which means that when a <B>SCHED_FIFO</B> thread becomes runnable,
|
|
it will always immediately preempt any currently running
|
|
<B>SCHED_OTHER</B>, <B>SCHED_BATCH</B>, or <B>SCHED_IDLE</B> thread.
|
|
<B>SCHED_FIFO</B> is a simple scheduling
|
|
algorithm without time slicing.
|
|
For threads scheduled under the
|
|
<B>SCHED_FIFO</B> policy, the following rules apply:
|
|
<DL COMPACT>
|
|
<DT id="16">1)<DD>
|
|
A running <B>SCHED_FIFO</B> thread that has been preempted by another thread of
|
|
higher priority will stay at the head of the list for its priority and
|
|
will resume execution as soon as all threads of higher priority are
|
|
blocked again.
|
|
<DT id="17">2)<DD>
|
|
When a blocked <B>SCHED_FIFO</B> thread becomes runnable, it
|
|
will be inserted at the end of the list for its priority.
|
|
<DT id="18">3)<DD>
|
|
If a call to
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setscheduler">sched_setscheduler</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setparam">sched_setparam</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_setschedparam">pthread_setschedparam</A></B>(3),
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_setschedprio">pthread_setschedprio</A></B>(3)
|
|
|
|
changes the priority of the running or runnable
|
|
<B>SCHED_FIFO</B>
|
|
|
|
thread identified by
|
|
<I>pid</I>
|
|
|
|
the effect on the thread's position in the list depends on
|
|
the direction of the change to threads priority:
|
|
<DL COMPACT><DT id="19"><DD>
|
|
<DL COMPACT>
|
|
<DT id="20">•<DD>
|
|
If the thread's priority is raised,
|
|
it is placed at the end of the list for its new priority.
|
|
As a consequence,
|
|
it may preempt a currently running thread with the same priority.
|
|
<DT id="21">•<DD>
|
|
If the thread's priority is unchanged,
|
|
its position in the run list is unchanged.
|
|
<DT id="22">•<DD>
|
|
If the thread's priority is lowered,
|
|
it is placed at the front of the list for its new priority.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="23"><DD>
|
|
According to POSIX.1-2008,
|
|
changes to a thread's priority (or policy) using any mechanism other than
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_setschedprio">pthread_setschedprio</A></B>(3)
|
|
|
|
should result in the thread being placed at the end of
|
|
the list for its priority.
|
|
|
|
|
|
<DT id="24">4)<DD>
|
|
A thread calling
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_yield">sched_yield</A></B>(2)
|
|
|
|
will be put at the end of the list.
|
|
</DL>
|
|
<P>
|
|
|
|
No other events will move a thread
|
|
scheduled under the <B>SCHED_FIFO</B> policy in the wait list of
|
|
runnable threads with equal static priority.
|
|
<P>
|
|
|
|
A <B>SCHED_FIFO</B>
|
|
thread runs until either it is blocked by an I/O request, it is
|
|
preempted by a higher priority thread, or it calls
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_yield">sched_yield</A></B>(2).
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H3>SCHED_RR: Round-robin scheduling</H3>
|
|
|
|
<B>SCHED_RR</B> is a simple enhancement of <B>SCHED_FIFO</B>.
|
|
Everything
|
|
described above for <B>SCHED_FIFO</B> also applies to <B>SCHED_RR</B>,
|
|
except that each thread is allowed to run only for a maximum time
|
|
quantum.
|
|
If a <B>SCHED_RR</B> thread has been running for a time
|
|
period equal to or longer than the time quantum, it will be put at the
|
|
end of the list for its priority.
|
|
A <B>SCHED_RR</B> thread that has
|
|
been preempted by a higher priority thread and subsequently resumes
|
|
execution as a running thread will complete the unexpired portion of
|
|
its round-robin time quantum.
|
|
The length of the time quantum can be
|
|
retrieved using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_rr_get_interval">sched_rr_get_interval</A></B>(2).
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H3>SCHED_DEADLINE: Sporadic task model deadline scheduling</H3>
|
|
|
|
Since version 3.14, Linux provides a deadline scheduling policy
|
|
(<B>SCHED_DEADLINE</B>).
|
|
|
|
This policy is currently implemented using
|
|
GEDF (Global Earliest Deadline First)
|
|
in conjunction with CBS (Constant Bandwidth Server).
|
|
To set and fetch this policy and associated attributes,
|
|
one must use the Linux-specific
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_getattr">sched_getattr</A></B>(2)
|
|
|
|
system calls.
|
|
<P>
|
|
|
|
A sporadic task is one that has a sequence of jobs, where each
|
|
job is activated at most once per period.
|
|
Each job also has a
|
|
<I>relative deadline</I>,
|
|
|
|
before which it should finish execution, and a
|
|
<I>computation time</I>,
|
|
|
|
which is the CPU time necessary for executing the job.
|
|
The moment when a task wakes up
|
|
because a new job has to be executed is called the
|
|
<I>arrival time</I>
|
|
|
|
(also referred to as the request time or release time).
|
|
The
|
|
<I>start time</I>
|
|
|
|
is the time at which a task starts its execution.
|
|
The
|
|
<I>absolute deadline</I>
|
|
|
|
is thus obtained by adding the relative deadline to the arrival time.
|
|
<P>
|
|
|
|
The following diagram clarifies these terms:
|
|
<P>
|
|
|
|
|
|
|
|
arrival/wakeup absolute deadline
|
|
<BR> | start time |
|
|
<BR> | | |
|
|
<BR> v v v
|
|
-----x--------xooooooooooooooooo--------x--------x---
|
|
<BR> |<- comp. time ->|
|
|
<BR> |<------- relative deadline ------>|
|
|
<BR> |<-------------- period ------------------->|
|
|
|
|
|
|
<P>
|
|
|
|
When setting a
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
policy for a thread using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2),
|
|
|
|
one can specify three parameters:
|
|
<I>Runtime</I>,
|
|
|
|
<I>Deadline</I>,
|
|
|
|
and
|
|
<I>Period</I>.
|
|
|
|
These parameters do not necessarily correspond to the aforementioned terms:
|
|
usual practice is to set Runtime to something bigger than the average
|
|
computation time (or worst-case execution time for hard real-time tasks),
|
|
Deadline to the relative deadline, and Period to the period of the task.
|
|
Thus, for
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
scheduling, we have:
|
|
<P>
|
|
|
|
|
|
|
|
arrival/wakeup absolute deadline
|
|
<BR> | start time |
|
|
<BR> | | |
|
|
<BR> v v v
|
|
-----x--------xooooooooooooooooo--------x--------x---
|
|
<BR> |<-- Runtime ------->|
|
|
<BR> |<----------- Deadline ----------->|
|
|
<BR> |<-------------- Period ------------------->|
|
|
|
|
|
|
<P>
|
|
|
|
The three deadline-scheduling parameters correspond to the
|
|
<I>sched_runtime</I>,
|
|
|
|
<I>sched_deadline</I>,
|
|
|
|
and
|
|
<I>sched_period</I>
|
|
|
|
fields of the
|
|
<I>sched_attr</I>
|
|
|
|
structure; see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2).
|
|
|
|
These fields express values in nanoseconds.
|
|
|
|
|
|
|
|
If
|
|
<I>sched_period</I>
|
|
|
|
is specified as 0, then it is made the same as
|
|
<I>sched_deadline</I>.
|
|
|
|
<P>
|
|
|
|
The kernel requires that:
|
|
<P>
|
|
|
|
<BR> sched_runtime <= sched_deadline <= sched_period
|
|
<P>
|
|
|
|
|
|
In addition, under the current implementation,
|
|
all of the parameter values must be at least 1024
|
|
(i.e., just over one microsecond,
|
|
which is the resolution of the implementation), and less than 2^63.
|
|
If any of these checks fails,
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2)
|
|
|
|
fails with the error
|
|
<B>EINVAL</B>.
|
|
|
|
<P>
|
|
|
|
The CBS guarantees non-interference between tasks, by throttling
|
|
threads that attempt to over-run their specified Runtime.
|
|
<P>
|
|
|
|
To ensure deadline scheduling guarantees,
|
|
the kernel must prevent situations where the set of
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
threads is not feasible (schedulable) within the given constraints.
|
|
The kernel thus performs an admittance test when setting or changing
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
policy and attributes.
|
|
This admission test calculates whether the change is feasible;
|
|
if it is not,
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2)
|
|
|
|
fails with the error
|
|
<B>EBUSY</B>.
|
|
|
|
<P>
|
|
|
|
For example, it is required (but not necessarily sufficient) for
|
|
the total utilization to be less than or equal to the total number of
|
|
CPUs available, where, since each thread can maximally run for
|
|
Runtime per Period, that thread's utilization is its
|
|
Runtime divided by its Period.
|
|
<P>
|
|
|
|
In order to fulfill the guarantees that are made when
|
|
a thread is admitted to the
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
policy,
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
threads are the highest priority (user controllable) threads in the
|
|
system; if any
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
thread is runnable,
|
|
it will preempt any thread scheduled under one of the other policies.
|
|
<P>
|
|
|
|
A call to
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2)
|
|
|
|
by a thread scheduled under the
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
policy fails with the error
|
|
<B>EAGAIN</B>,
|
|
|
|
unless the thread has its reset-on-fork flag set (see below).
|
|
<P>
|
|
|
|
A
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
thread that calls
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_yield">sched_yield</A></B>(2)
|
|
|
|
will yield the current job and wait for a new period to begin.
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H3>SCHED_OTHER: Default Linux time-sharing scheduling</H3>
|
|
|
|
<B>SCHED_OTHER</B> can be used at only static priority 0
|
|
(i.e., threads under real-time policies always have priority over
|
|
<B>SCHED_OTHER</B>
|
|
|
|
processes).
|
|
<B>SCHED_OTHER</B> is the standard Linux time-sharing scheduler that is
|
|
intended for all threads that do not require the special
|
|
real-time mechanisms.
|
|
<P>
|
|
|
|
The thread to run is chosen from the static
|
|
priority 0 list based on a <I>dynamic</I> priority that is determined only
|
|
inside this list.
|
|
The dynamic priority is based on the nice value (see below)
|
|
and is increased for each time quantum the thread is ready to run,
|
|
but denied to run by the scheduler.
|
|
This ensures fair progress among all <B>SCHED_OTHER</B> threads.
|
|
<P>
|
|
|
|
In the Linux kernel source code, the
|
|
<B>SCHED_OTHER</B>
|
|
|
|
policy is actually named
|
|
<B>SCHED_NORMAL</B>.
|
|
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H3>The nice value</H3>
|
|
|
|
The nice value is an attribute
|
|
that can be used to influence the CPU scheduler to
|
|
favor or disfavor a process in scheduling decisions.
|
|
It affects the scheduling of
|
|
<B>SCHED_OTHER</B>
|
|
|
|
and
|
|
<B>SCHED_BATCH</B>
|
|
|
|
(see below) processes.
|
|
The nice value can be modified using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+nice">nice</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setpriority">setpriority</A></B>(2),
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2).
|
|
|
|
<P>
|
|
|
|
According to POSIX.1, the nice value is a per-process attribute;
|
|
that is, the threads in a process should share a nice value.
|
|
However, on Linux, the nice value is a per-thread attribute:
|
|
different threads in the same process may have different nice values.
|
|
<P>
|
|
|
|
The range of the nice value
|
|
varies across UNIX systems.
|
|
On modern Linux, the range is -20 (high priority) to +19 (low priority).
|
|
On some other systems, the range is -20..20.
|
|
Very early Linux kernels (Before Linux 2.0) had the range -infinity..15.
|
|
|
|
|
|
<P>
|
|
|
|
The degree to which the nice value affects the relative scheduling of
|
|
<B>SCHED_OTHER</B>
|
|
|
|
processes likewise varies across UNIX systems and
|
|
across Linux kernel versions.
|
|
<P>
|
|
|
|
With the advent of the CFS scheduler in kernel 2.6.23,
|
|
Linux adopted an algorithm that causes
|
|
relative differences in nice values to have a much stronger effect.
|
|
In the current implementation, each unit of difference in the
|
|
nice values of two processes results in a factor of 1.25
|
|
in the degree to which the scheduler favors the higher priority process.
|
|
This causes very low nice values (+19) to truly provide little CPU
|
|
to a process whenever there is any other
|
|
higher priority load on the system,
|
|
and makes high nice values (-20) deliver most of the CPU to applications
|
|
that require it (e.g., some audio applications).
|
|
<P>
|
|
|
|
On Linux, the
|
|
<B>RLIMIT_NICE</B>
|
|
|
|
resource limit can be used to define a limit to which
|
|
an unprivileged process's nice value can be raised; see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setrlimit">setrlimit</A></B>(2)
|
|
|
|
for details.
|
|
<P>
|
|
|
|
For further details on the nice value, see the subsections on
|
|
the autogroup feature and group scheduling, below.
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H3>SCHED_BATCH: Scheduling batch processes</H3>
|
|
|
|
(Since Linux 2.6.16.)
|
|
<B>SCHED_BATCH</B> can be used only at static priority 0.
|
|
This policy is similar to <B>SCHED_OTHER</B> in that it schedules
|
|
the thread according to its dynamic priority
|
|
(based on the nice value).
|
|
The difference is that this policy
|
|
will cause the scheduler to always assume
|
|
that the thread is CPU-intensive.
|
|
Consequently, the scheduler will apply a small scheduling
|
|
penalty with respect to wakeup behavior,
|
|
so that this thread is mildly disfavored in scheduling decisions.
|
|
<P>
|
|
|
|
|
|
|
|
|
|
|
|
This policy is useful for workloads that are noninteractive,
|
|
but do not want to lower their nice value,
|
|
and for workloads that want a deterministic scheduling policy without
|
|
interactivity causing extra preemptions (between the workload's tasks).
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H3>SCHED_IDLE: Scheduling very low priority jobs</H3>
|
|
|
|
(Since Linux 2.6.23.)
|
|
<B>SCHED_IDLE</B> can be used only at static priority 0;
|
|
the process nice value has no influence for this policy.
|
|
<P>
|
|
|
|
This policy is intended for running jobs at extremely low
|
|
priority (lower even than a +19 nice value with the
|
|
<B>SCHED_OTHER</B>
|
|
|
|
or
|
|
<B>SCHED_BATCH</B>
|
|
|
|
policies).
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H3>Resetting scheduling policy for child processes</H3>
|
|
|
|
Each thread has a reset-on-fork scheduling flag.
|
|
When this flag is set, children created by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2)
|
|
|
|
do not inherit privileged scheduling policies.
|
|
The reset-on-fork flag can be set by either:
|
|
<DL COMPACT>
|
|
<DT id="25">*<DD>
|
|
ORing the
|
|
<B>SCHED_RESET_ON_FORK</B>
|
|
|
|
flag into the
|
|
<I>policy</I>
|
|
|
|
argument when calling
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setscheduler">sched_setscheduler</A></B>(2)
|
|
|
|
(since Linux 2.6.32);
|
|
or
|
|
<DT id="26">*<DD>
|
|
specifying the
|
|
<B>SCHED_FLAG_RESET_ON_FORK</B>
|
|
|
|
flag in
|
|
<I>attr.sched_flags</I>
|
|
|
|
when calling
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setattr">sched_setattr</A></B>(2).
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
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
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_getscheduler">sched_getscheduler</A></B>(2)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_getattr">sched_getattr</A></B>(2).
|
|
|
|
<P>
|
|
|
|
The reset-on-fork feature is intended for media-playback applications,
|
|
and can be used to prevent applications evading the
|
|
<B>RLIMIT_RTTIME</B>
|
|
|
|
resource limit (see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getrlimit">getrlimit</A></B>(2))
|
|
|
|
by creating multiple child processes.
|
|
<P>
|
|
|
|
More precisely, if the reset-on-fork flag is set,
|
|
the following rules apply for subsequently created children:
|
|
<DL COMPACT>
|
|
<DT id="27">*<DD>
|
|
If the calling thread has a scheduling policy of
|
|
<B>SCHED_FIFO</B>
|
|
|
|
or
|
|
<B>SCHED_RR</B>,
|
|
|
|
the policy is reset to
|
|
<B>SCHED_OTHER</B>
|
|
|
|
in child processes.
|
|
<DT id="28">*<DD>
|
|
If the calling process has a negative nice value,
|
|
the nice value is reset to zero in child processes.
|
|
</DL>
|
|
<P>
|
|
|
|
After the reset-on-fork flag has been enabled,
|
|
it can be reset only if the thread has the
|
|
<B>CAP_SYS_NICE</B>
|
|
|
|
capability.
|
|
This flag is disabled in child processes created by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2).
|
|
|
|
|
|
<A NAME="lbAN"> </A>
|
|
<H3>Privileges and resource limits</H3>
|
|
|
|
In Linux kernels before 2.6.12, only privileged
|
|
(<B>CAP_SYS_NICE</B>)
|
|
|
|
threads can set a nonzero static priority (i.e., set a real-time
|
|
scheduling policy).
|
|
The only change that an unprivileged thread can make is to set the
|
|
<B>SCHED_OTHER</B>
|
|
|
|
policy, and this can be done only if the effective user ID of the caller
|
|
matches the real or effective user ID of the target thread
|
|
(i.e., the thread specified by
|
|
<I>pid</I>)
|
|
|
|
whose policy is being changed.
|
|
<P>
|
|
|
|
A thread must be privileged
|
|
(<B>CAP_SYS_NICE</B>)
|
|
|
|
in order to set or modify a
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
policy.
|
|
<P>
|
|
|
|
Since Linux 2.6.12, the
|
|
<B>RLIMIT_RTPRIO</B>
|
|
|
|
resource limit defines a ceiling on an unprivileged thread's
|
|
static priority for the
|
|
<B>SCHED_RR</B>
|
|
|
|
and
|
|
<B>SCHED_FIFO</B>
|
|
|
|
policies.
|
|
The rules for changing scheduling policy and priority are as follows:
|
|
<DL COMPACT>
|
|
<DT id="29">*<DD>
|
|
If an unprivileged thread has a nonzero
|
|
<B>RLIMIT_RTPRIO</B>
|
|
|
|
soft limit, then it can change its scheduling policy and priority,
|
|
subject to the restriction that the priority cannot be set to a
|
|
value higher than the maximum of its current priority and its
|
|
<B>RLIMIT_RTPRIO</B>
|
|
|
|
soft limit.
|
|
<DT id="30">*<DD>
|
|
If the
|
|
<B>RLIMIT_RTPRIO</B>
|
|
|
|
soft limit is 0, then the only permitted changes are to lower the priority,
|
|
or to switch to a non-real-time policy.
|
|
<DT id="31">*<DD>
|
|
Subject to the same rules,
|
|
another unprivileged thread can also make these changes,
|
|
as long as the effective user ID of the thread making the change
|
|
matches the real or effective user ID of the target thread.
|
|
<DT id="32">*<DD>
|
|
Special rules apply for the
|
|
<B>SCHED_IDLE</B>
|
|
|
|
policy.
|
|
In Linux kernels before 2.6.39,
|
|
an unprivileged thread operating under this policy cannot
|
|
change its policy, regardless of the value of its
|
|
<B>RLIMIT_RTPRIO</B>
|
|
|
|
resource limit.
|
|
In Linux kernels since 2.6.39,
|
|
|
|
an unprivileged thread can switch to either the
|
|
<B>SCHED_BATCH</B>
|
|
|
|
or the
|
|
<B>SCHED_OTHER</B>
|
|
|
|
policy so long as its nice value falls within the range permitted by its
|
|
<B>RLIMIT_NICE</B>
|
|
|
|
resource limit (see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getrlimit">getrlimit</A></B>(2)).
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
Privileged
|
|
(<B>CAP_SYS_NICE</B>)
|
|
|
|
threads ignore the
|
|
<B>RLIMIT_RTPRIO</B>
|
|
|
|
limit; as with older kernels,
|
|
they can make arbitrary changes to scheduling policy and priority.
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getrlimit">getrlimit</A></B>(2)
|
|
|
|
for further information on
|
|
<B>RLIMIT_RTPRIO</B>.
|
|
|
|
<A NAME="lbAO"> </A>
|
|
<H3>Limiting the CPU usage of real-time and deadline processes</H3>
|
|
|
|
A nonblocking infinite loop in a thread scheduled under the
|
|
<B>SCHED_FIFO</B>,
|
|
|
|
<B>SCHED_RR</B>,
|
|
|
|
or
|
|
<B>SCHED_DEADLINE</B>
|
|
|
|
policy can potentially block all other threads from accessing
|
|
the CPU forever.
|
|
Prior to Linux 2.6.25, the only way of preventing a runaway real-time
|
|
process from freezing the system was to run (at the console)
|
|
a shell scheduled under a higher static priority than the tested application.
|
|
This allows an emergency kill of tested
|
|
real-time applications that do not block or terminate as expected.
|
|
<P>
|
|
|
|
Since Linux 2.6.25, there are other techniques for dealing with runaway
|
|
real-time and deadline processes.
|
|
One of these is to use the
|
|
<B>RLIMIT_RTTIME</B>
|
|
|
|
resource limit to set a ceiling on the CPU time that
|
|
a real-time process may consume.
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getrlimit">getrlimit</A></B>(2)
|
|
|
|
for details.
|
|
<P>
|
|
|
|
Since version 2.6.25, Linux also provides two
|
|
<I>/proc</I>
|
|
|
|
files that can be used to reserve a certain amount of CPU time
|
|
to be used by non-real-time processes.
|
|
Reserving CPU time in this fashion allows some CPU time to be
|
|
allocated to (say) a root shell that can be used to kill a runaway process.
|
|
Both of these files specify time values in microseconds:
|
|
<DL COMPACT>
|
|
<DT id="33"><I>/proc/sys/kernel/sched_rt_period_us</I>
|
|
|
|
<DD>
|
|
This file specifies a scheduling period that is equivalent to
|
|
100% CPU bandwidth.
|
|
The value in this file can range from 1 to
|
|
<B>INT_MAX</B>,
|
|
|
|
giving an operating range of 1 microsecond to around 35 minutes.
|
|
The default value in this file is 1,000,000 (1 second).
|
|
<DT id="34"><I>/proc/sys/kernel/sched_rt_runtime_us</I>
|
|
|
|
<DD>
|
|
The value in this file specifies how much of the "period" time
|
|
can be used by all real-time and deadline scheduled processes
|
|
on the system.
|
|
The value in this file can range from -1 to
|
|
<B>INT_MAX</B>-1.
|
|
|
|
Specifying -1 makes the run time the same as the period;
|
|
that is, no CPU time is set aside for non-real-time processes
|
|
(which was the Linux behavior before kernel 2.6.25).
|
|
The default value in this file is 950,000 (0.95 seconds),
|
|
meaning that 5% of the CPU time is reserved for processes that
|
|
don't run under a real-time or deadline scheduling policy.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="lbAP"> </A>
|
|
<H3>Response time</H3>
|
|
|
|
A blocked high priority thread waiting for I/O has a certain
|
|
response time before it is scheduled again.
|
|
The device driver writer
|
|
can greatly reduce this response time by using a "slow interrupt"
|
|
interrupt handler.
|
|
|
|
|
|
<A NAME="lbAQ"> </A>
|
|
<H3>Miscellaneous</H3>
|
|
|
|
Child processes inherit the scheduling policy and parameters across a
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2).
|
|
|
|
The scheduling policy and parameters are preserved across
|
|
<B><A HREF="/cgi-bin/man/man2html?2+execve">execve</A></B>(2).
|
|
|
|
<P>
|
|
|
|
Memory locking is usually needed for real-time processes to avoid
|
|
paging delays; this can be done with
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mlock">mlock</A></B>(2)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mlockall">mlockall</A></B>(2).
|
|
|
|
|
|
<A NAME="lbAR"> </A>
|
|
<H3>The autogroup feature</H3>
|
|
|
|
|
|
Since Linux 2.6.38,
|
|
the kernel provides a feature known as autogrouping to improve interactive
|
|
desktop performance in the face of multiprocess, CPU-intensive
|
|
workloads such as building the Linux kernel with large numbers of
|
|
parallel build processes (i.e., the
|
|
<B><A HREF="/cgi-bin/man/man2html?1+make">make</A></B>(1)
|
|
|
|
<B>-j</B>
|
|
|
|
flag).
|
|
<P>
|
|
|
|
This feature operates in conjunction with the
|
|
CFS scheduler and requires a kernel that is configured with
|
|
<B>CONFIG_SCHED_AUTOGROUP</B>.
|
|
|
|
On a running system, this feature is enabled or disabled via the file
|
|
<I>/proc/sys/kernel/sched_autogroup_enabled</I>;
|
|
|
|
a value of 0 disables the feature, while a value of 1 enables it.
|
|
The default value in this file is 1, unless the kernel was booted with the
|
|
<I>noautogroup</I>
|
|
|
|
parameter.
|
|
<P>
|
|
|
|
A new autogroup is created when a new session is created via
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setsid">setsid</A></B>(2);
|
|
|
|
this happens, for example, when a new terminal window is started.
|
|
A new process created by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2)
|
|
|
|
inherits its parent's autogroup membership.
|
|
Thus, all of the processes in a session are members of the same autogroup.
|
|
An autogroup is automatically destroyed when the last process
|
|
in the group terminates.
|
|
<P>
|
|
|
|
When autogrouping is enabled, all of the members of an autogroup
|
|
are placed in the same kernel scheduler "task group".
|
|
The CFS scheduler employs an algorithm that equalizes the
|
|
distribution of CPU cycles across task groups.
|
|
The benefits of this for interactive desktop performance
|
|
can be described via the following example.
|
|
<P>
|
|
|
|
Suppose that there are two autogroups competing for the same CPU
|
|
(i.e., presume either a single CPU system or the use of
|
|
<B><A HREF="/cgi-bin/man/man2html?1+taskset">taskset</A></B>(1)
|
|
|
|
to confine all the processes to the same CPU on an SMP system).
|
|
The first group contains ten CPU-bound processes from
|
|
a kernel build started with
|
|
<I>make -j10</I>.
|
|
|
|
The other contains a single CPU-bound process: a video player.
|
|
The effect of autogrouping is that the two groups will
|
|
each receive half of the CPU cycles.
|
|
That is, the video player will receive 50% of the CPU cycles,
|
|
rather than just 9% of the cycles,
|
|
which would likely lead to degraded video playback.
|
|
The situation on an SMP system is more complex,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
but the general effect is the same:
|
|
the scheduler distributes CPU cycles across task groups such that
|
|
an autogroup that contains a large number of CPU-bound processes
|
|
does not end up hogging CPU cycles at the expense of the other
|
|
jobs on the system.
|
|
<P>
|
|
|
|
A process's autogroup (task group) membership can be viewed via the file
|
|
<I>/proc/[pid]/autogroup</I>:
|
|
|
|
<P>
|
|
|
|
|
|
|
|
$ <B>cat /proc/1/autogroup</B>
|
|
/autogroup-1 nice 0
|
|
|
|
|
|
<P>
|
|
|
|
This file can also be used to modify the CPU bandwidth allocated
|
|
to an autogroup.
|
|
This is done by writing a number in the "nice" range to the file
|
|
to set the autogroup's nice value.
|
|
The allowed range is from +19 (low priority) to -20 (high priority).
|
|
(Writing values outside of this range causes
|
|
<B><A HREF="/cgi-bin/man/man2html?2+write">write</A></B>(2)
|
|
|
|
to fail with the error
|
|
<B>EINVAL</B>.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
The autogroup nice setting has the same meaning as the process nice value,
|
|
but applies to distribution of CPU cycles to the autogroup as a whole,
|
|
based on the relative nice values of other autogroups.
|
|
For a process inside an autogroup, the CPU cycles that it receives
|
|
will be a product of the autogroup's nice value
|
|
(compared to other autogroups)
|
|
and the process's nice value
|
|
(compared to other processes in the same autogroup.
|
|
<P>
|
|
|
|
The use of the
|
|
<B><A HREF="/cgi-bin/man/man2html?7+cgroups">cgroups</A></B>(7)
|
|
|
|
CPU controller to place processes in cgroups other than the
|
|
root CPU cgroup overrides the effect of autogrouping.
|
|
<P>
|
|
|
|
The autogroup feature groups only processes scheduled under
|
|
non-real-time policies
|
|
(<B>SCHED_OTHER</B>,
|
|
|
|
<B>SCHED_BATCH</B>,
|
|
|
|
and
|
|
<B>SCHED_IDLE</B>).
|
|
|
|
It does not group processes scheduled under real-time and
|
|
deadline policies.
|
|
Those processes are scheduled according to the rules described earlier.
|
|
|
|
<A NAME="lbAS"> </A>
|
|
<H3>The nice value and group scheduling</H3>
|
|
|
|
When scheduling non-real-time processes (i.e., those scheduled under the
|
|
<B>SCHED_OTHER</B>,
|
|
|
|
<B>SCHED_BATCH</B>,
|
|
|
|
and
|
|
<B>SCHED_IDLE</B>
|
|
|
|
policies), the CFS scheduler employs a technique known as "group scheduling",
|
|
if the kernel was configured with the
|
|
<B>CONFIG_FAIR_GROUP_SCHED</B>
|
|
|
|
option (which is typical).
|
|
<P>
|
|
|
|
Under group scheduling, threads are scheduled in "task groups".
|
|
Task groups have a hierarchical relationship,
|
|
rooted under the initial task group on the system,
|
|
known as the "root task group".
|
|
Task groups are formed in the following circumstances:
|
|
<DL COMPACT>
|
|
<DT id="35">*<DD>
|
|
All of the threads in a CPU cgroup form a task group.
|
|
The parent of this task group is the task group of the
|
|
corresponding parent cgroup.
|
|
<DT id="36">*<DD>
|
|
If autogrouping is enabled,
|
|
then all of the threads that are (implicitly) placed in an autogroup
|
|
(i.e., the same session, as created by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setsid">setsid</A></B>(2))
|
|
|
|
form a task group.
|
|
Each new autogroup is thus a separate task group.
|
|
The root task group is the parent of all such autogroups.
|
|
<DT id="37">*<DD>
|
|
If autogrouping is enabled, then the root task group consists of
|
|
all processes in the root CPU cgroup that were not
|
|
otherwise implicitly placed into a new autogroup.
|
|
<DT id="38">*<DD>
|
|
If autogrouping is disabled, then the root task group consists of
|
|
all processes in the root CPU cgroup.
|
|
<DT id="39">*<DD>
|
|
If group scheduling was disabled (i.e., the kernel was configured without
|
|
<B>CONFIG_FAIR_GROUP_SCHED</B>),
|
|
|
|
then all of the processes on the system are notionally placed
|
|
in a single task group.
|
|
</DL>
|
|
<P>
|
|
|
|
Under group scheduling,
|
|
a thread's nice value has an effect for scheduling decisions
|
|
<I>only relative to other threads in the same task group</I>.
|
|
|
|
This has some surprising consequences in terms of the traditional semantics
|
|
of the nice value on UNIX systems.
|
|
In particular, if autogrouping
|
|
is enabled (which is the default in various distributions), then employing
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setpriority">setpriority</A></B>(2)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?1+nice">nice</A></B>(1)
|
|
|
|
on a process has an effect only for scheduling relative
|
|
to other processes executed in the same session
|
|
(typically: the same terminal window).
|
|
<P>
|
|
|
|
Conversely, for two processes that are (for example)
|
|
the sole CPU-bound processes in different sessions
|
|
(e.g., different terminal windows,
|
|
each of whose jobs are tied to different autogroups),
|
|
<I>modifying the nice value of the process in one of the sessions</I>
|
|
|
|
<I>has no effect</I>
|
|
|
|
in terms of the scheduler's decisions relative to the
|
|
process in the other session.
|
|
|
|
|
|
|
|
A possibly useful workaround here is to use a command such as
|
|
the following to modify the autogroup nice value for
|
|
<I>all</I>
|
|
|
|
of the processes in a terminal session:
|
|
<P>
|
|
|
|
|
|
|
|
$ <B>echo 10 > /proc/self/autogroup</B>
|
|
|
|
|
|
<A NAME="lbAT"> </A>
|
|
<H3>Real-time features in the mainline Linux kernel</H3>
|
|
|
|
|
|
|
|
Since kernel version 2.6.18, Linux is gradually
|
|
becoming equipped with real-time capabilities,
|
|
most of which are derived from the former
|
|
<I>realtime-preempt</I>
|
|
|
|
patch set.
|
|
Until the patches have been completely merged into the
|
|
mainline kernel,
|
|
they must be installed to achieve the best real-time performance.
|
|
These patches are named:
|
|
<P>
|
|
|
|
|
|
|
|
patch-<I>kernelversion</I>-rt<I>patchversion</I>
|
|
|
|
|
|
<P>
|
|
|
|
and can be downloaded from
|
|
|
|
|
|
<P>
|
|
|
|
Without the patches and prior to their full inclusion into the mainline
|
|
kernel, the kernel configuration offers only the three preemption classes
|
|
<B>CONFIG_PREEMPT_NONE</B>,
|
|
|
|
<B>CONFIG_PREEMPT_VOLUNTARY</B>,
|
|
|
|
and
|
|
<B>CONFIG_PREEMPT_DESKTOP</B>
|
|
|
|
which respectively provide no, some, and considerable
|
|
reduction of the worst-case scheduling latency.
|
|
<P>
|
|
|
|
With the patches applied or after their full inclusion into the mainline
|
|
kernel, the additional configuration item
|
|
<B>CONFIG_PREEMPT_RT</B>
|
|
|
|
becomes available.
|
|
If this is selected, Linux is transformed into a regular
|
|
real-time operating system.
|
|
The FIFO and RR scheduling policies are then used to run a thread
|
|
with true real-time priority and a minimum worst-case scheduling latency.
|
|
<A NAME="lbAU"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
The
|
|
<B><A HREF="/cgi-bin/man/man2html?7+cgroups">cgroups</A></B>(7)
|
|
|
|
CPU controller can be used to limit the CPU consumption of
|
|
groups of processes.
|
|
<P>
|
|
|
|
Originally, Standard Linux was intended as a general-purpose operating
|
|
system being able to handle background processes, interactive
|
|
applications, and less demanding real-time applications (applications that
|
|
need to usually meet timing deadlines).
|
|
Although the Linux kernel 2.6
|
|
allowed for kernel preemption and the newly introduced <A HREF="/cgi-bin/man/man2html?1+O">O</A>(1) scheduler
|
|
ensures that the time needed to schedule is fixed and deterministic
|
|
irrespective of the number of active tasks, true real-time computing
|
|
was not possible up to kernel version 2.6.17.
|
|
<A NAME="lbAV"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+chcpu">chcpu</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+chrt">chrt</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+lscpu">lscpu</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ps">ps</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+taskset">taskset</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+top">top</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getpriority">getpriority</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mlock">mlock</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mlockall">mlockall</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+munlock">munlock</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+munlockall">munlockall</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+nice">nice</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_max">sched_get_priority_max</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_get_priority_min">sched_get_priority_min</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_getaffinity">sched_getaffinity</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_getparam">sched_getparam</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_getscheduler">sched_getscheduler</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_rr_get_interval">sched_rr_get_interval</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setaffinity">sched_setaffinity</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setparam">sched_setparam</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_setscheduler">sched_setscheduler</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sched_yield">sched_yield</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setpriority">setpriority</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_getaffinity_np">pthread_getaffinity_np</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_getschedparam">pthread_getschedparam</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_setaffinity_np">pthread_setaffinity_np</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sched_getcpu">sched_getcpu</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+capabilities">capabilities</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+cpuset">cpuset</A></B>(7)
|
|
|
|
|
|
<P>
|
|
|
|
<I>Programming for the real world - POSIX.4</I>
|
|
|
|
by Bill O. Gallmeister, O'Reilly & Associates, Inc., ISBN 1-56592-074-0.
|
|
<P>
|
|
|
|
The Linux kernel source files
|
|
<I>Documentation/scheduler/sched-deadline.txt</I>,
|
|
|
|
<I>Documentation/scheduler/sched-rt-group.txt</I>,
|
|
|
|
<I>Documentation/scheduler/sched-design-CFS.txt</I>,
|
|
|
|
and
|
|
<I>Documentation/scheduler/sched-nice-design.txt</I>
|
|
|
|
<A NAME="lbAW"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="40"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="41"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="42"><A HREF="#lbAD">API summary</A><DD>
|
|
<DT id="43"><A HREF="#lbAE">Scheduling policies</A><DD>
|
|
<DT id="44"><A HREF="#lbAF">SCHED_FIFO: First in-first out scheduling</A><DD>
|
|
<DT id="45"><A HREF="#lbAG">SCHED_RR: Round-robin scheduling</A><DD>
|
|
<DT id="46"><A HREF="#lbAH">SCHED_DEADLINE: Sporadic task model deadline scheduling</A><DD>
|
|
<DT id="47"><A HREF="#lbAI">SCHED_OTHER: Default Linux time-sharing scheduling</A><DD>
|
|
<DT id="48"><A HREF="#lbAJ">The nice value</A><DD>
|
|
<DT id="49"><A HREF="#lbAK">SCHED_BATCH: Scheduling batch processes</A><DD>
|
|
<DT id="50"><A HREF="#lbAL">SCHED_IDLE: Scheduling very low priority jobs</A><DD>
|
|
<DT id="51"><A HREF="#lbAM">Resetting scheduling policy for child processes</A><DD>
|
|
<DT id="52"><A HREF="#lbAN">Privileges and resource limits</A><DD>
|
|
<DT id="53"><A HREF="#lbAO">Limiting the CPU usage of real-time and deadline processes</A><DD>
|
|
<DT id="54"><A HREF="#lbAP">Response time</A><DD>
|
|
<DT id="55"><A HREF="#lbAQ">Miscellaneous</A><DD>
|
|
<DT id="56"><A HREF="#lbAR">The autogroup feature</A><DD>
|
|
<DT id="57"><A HREF="#lbAS">The nice value and group scheduling</A><DD>
|
|
<DT id="58"><A HREF="#lbAT">Real-time features in the mainline Linux kernel</A><DD>
|
|
</DL>
|
|
<DT id="59"><A HREF="#lbAU">NOTES</A><DD>
|
|
<DT id="60"><A HREF="#lbAV">SEE ALSO</A><DD>
|
|
<DT id="61"><A HREF="#lbAW">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:09 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|