\subsection{Processes and scheduling}

\begin{frame}
  \frametitle{Process, thread?}
  \begin{itemize}
  \item Confusion about the terms \emph{process}, \emph{thread} and
    \emph{task}
  \item In Unix, a process is created using \code{fork()} and is
    composed of
    \begin{itemize}
    \item An address space, which contains the program code, data,
      stack, shared libraries, etc.
    \item One thread, that starts executing the \code{main()}
      function.
    \item Upon creation, a process contains one thread
    \end{itemize}
  \item Additional threads can be created inside an existing process,
    using \code{pthread_create()}
    \begin{itemize}
    \item They run in the same address space as the initial thread of
      the process
    \item They start executing a function passed as argument to
      \code{pthread_create()}
    \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Process, thread: kernel point of view}
  \begin{itemize}
  \item The kernel represents each thread running in the system by a
    structure of type \code{task_struct}
  \item From a scheduling point of view, it makes no difference
    between the initial thread of a process and all additional threads
    created dynamically using \code{pthread_create()}
  \end{itemize}
  \begin{center}
    \includegraphics[width=\textwidth]{slides/kernel-driver-development-processes/address-space.pdf}
  \end{center}
\end{frame}

\begin{frame}
  \frametitle{A thread life}
  \begin{center}
    \includegraphics[width=\textwidth]{slides/kernel-driver-development-processes/threads-life.pdf}
  \end{center}
\end{frame}

\begin{frame}
  \frametitle{Execution of system calls}
  \begin{center}
    \includegraphics[width=\textwidth]{slides/kernel-driver-development-processes/syscalls.pdf}\\
    The execution of system calls takes place in the context of the
    thread requesting them.
  \end{center}
\end{frame}

