51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
\chapter{threads}
 | 
						|
\index{threads}
 | 
						|
 | 
						|
% ----------------------------------------------------------------
 | 
						|
 | 
						|
Ahemmm, par quoi commencer\footnote{Par de l'aspirine ?} ? 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}
 | 
						|
 | 
						|
% ----------------------------------------------------------------
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 |