Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
realtime: move scheduling classes into a separate file for reuse
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
- Loading branch information
1 parent
30265be
commit 54b920f
Showing
2 changed files
with
60 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
\begin{frame} | ||
\frametitle{The Linux Kernel Scheduler} | ||
\begin{itemize} | ||
\item The Linux Kernel Scheduler is a key piece in having a real-time behaviour | ||
\item It is in charge of deciding which \textbf{runnable} task gets executed | ||
\item It also elects on which CPU the task runs, and it tightly coupled to CPUidle and CPUFreq | ||
\item It schedules both \textbf{userspace} tasks, but also \textbf{kernel} tasks | ||
\item Each task is assigned one \textbf{scheduling class} or \textbf{policy} | ||
\item The class determines the algorithm used to elect each task | ||
\item Tasks with different scheduling classes can coexist on the system | ||
\end{itemize} | ||
\end{frame} | ||
|
||
\begin{frame} | ||
\frametitle{Non-Realtime Scheduling Classes} | ||
There are 3 \textbf{Non-RealTime} classes | ||
\begin{itemize} | ||
\item \code{SCHED_OTHER} : The default policy, using a time-sharing algorithm | ||
\item \ksym{SCHED_BATCH} : Similar to \code{SCHED_OTHER}, but designed for CPU-intensive loads that affect the wakeup time | ||
\item \ksym{SCHED_IDLE} : Very low priority class. Tasks with this policy will run only if nothing else needs to run. | ||
\item \code{SCHED_OTHER} and \ksym{SCHED_BATCH} use the \textbf{nice} value to increase or decrease their scheduling frequency | ||
\item A higher nice value means that the tasks gets scheduled \textbf{less} often | ||
\end{itemize} | ||
\end{frame} | ||
|
||
\begin{frame} | ||
\frametitle{Realtime Scheduling Classes} | ||
There are 3 \textbf{Realtime} classes | ||
\begin{itemize} | ||
\item Tasks under a Realtime class can be assigned a priority between 0 and 98 | ||
\item Priority 99 is \textbf{reserved} for critical housekeeping tasks | ||
\item Runnable tasks will preempt any other lower-priority task | ||
\item \ksym{SCHED_FIFO} : All tasks with the same priority are scheduled \textbf{First in, First out} | ||
\item \ksym{SCHED_RR} : Similar to SCHED\_FIFO but with a time-sharing round-robin between tasks with the same priority | ||
\item \ksym{SCHED_DEADLINE} : For tasks doing recurrent jobs, extra attributes are attached to a task | ||
\begin{itemize} | ||
\item A computation time, which represents the time the tasks needs to complete a job | ||
\item A deadline, which is the maximum allowable time to compute the job | ||
\item A period, during which only one job can occur | ||
\end{itemize} | ||
\end{itemize} | ||
\end{frame} | ||
|
||
\begin{frame} | ||
\frametitle{Changing the Scheduling Class} | ||
\begin{itemize} | ||
\item The Scheduling Class is set per-task, and defaults to \code{SCHED_OTHER} | ||
\item The \code{sched_setscheduler} syscall allows changing the class of a task | ||
\item The tool \code{chrt} uses it to allow changing the class of a running task : | ||
\begin{itemize} | ||
\item \code{chrt -f/-b/-o/-r -p PRIO PID} | ||
\end{itemize} | ||
\item It can also be used to launch a new program with a dedicated class : | ||
\begin{itemize} | ||
\item \code{chrt -f/-b/-o/-r PRIO CMD} | ||
\end{itemize} | ||
\item New processes will inherit the class of their parent except if the \ksym{SCHED_RESET_ON_FORK} flag is set with \code{sched_setscheduler} | ||
\end{itemize} | ||
\end{frame} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters