You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.5 KiB
53 lines
1.5 KiB
\chapter{threads} |
|
\index{threads} |
|
|
|
% ---------------------------------------------------------------- |
|
|
|
Ahemmm, par quoi commencer\footnote{Par de l'aspirine ?} ? |
|
La programmation avec les fils d'exécution est un espace |
|
rempli de chausse-trappes. |
|
Par un |
|
extrait de la page \texttt{pthreads(6)} ? Voilà, ça c'est bien : |
|
|
|
\begin{quote} |
|
POSIX.1 specifies a set of interfaces (functions, header files) for |
|
threaded programming commonly known as Pthreads. |
|
A single process can contain multiple threads, all of which are |
|
executing the same program. These threads share the same global |
|
memory (data and heap segments), but each thread has its own stack |
|
(automatic variables). |
|
\end{quote} |
|
|
|
Et c'est là que les ennuis potentiels débarquent : |
|
\textit{share the same global memory}, ce qui veut dire en gros |
|
«~se partagent la même mémoire globale~». |
|
|
|
% ---------------------------------------------------------------- |
|
|
|
\section{ITC} |
|
\index{ITC} |
|
|
|
\textit{Inter Thread Communication} |
|
|
|
Imaginons une application avec un thread qui fait le travail effectif |
|
(nous le nommerons \textsl{worker}), et plusieurs autres threads |
|
qui attendent des ordres de l'extérieur (telnet, MIDI\index{MIDI}, |
|
joystick\index{joystick}\dots) et qui doivent passer ces commandes |
|
au \textsl{worker}. |
|
|
|
Comment allons-nous procéder\footnote{Et c'est une vraie question !} ? |
|
|
|
Une première piste : http://tools.ietf.org/html/rfc3117 |
|
|
|
% ---------------------------------------------------------------- |
|
\section{Un exemple} |
|
|
|
XXX\index{XXX} |
|
|
|
% ---------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|