diff --git a/common/scheduling-classes.tex b/common/scheduling-classes.tex new file mode 100644 index 000000000..8290e8411 --- /dev/null +++ b/common/scheduling-classes.tex @@ -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} \ No newline at end of file diff --git a/slides/realtime-linux-configuration/realtime-linux-configuration.tex b/slides/realtime-linux-configuration/realtime-linux-configuration.tex index a03366fe8..58b578e66 100644 --- a/slides/realtime-linux-configuration/realtime-linux-configuration.tex +++ b/slides/realtime-linux-configuration/realtime-linux-configuration.tex @@ -63,65 +63,7 @@ \section{Configuring the system} \end{frame} % scheduling classes -\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} +\input{../common/scheduling-classes.tex} \begin{frame} \frametitle{Realtime policies and CPU hogging}