François Trahay


fork() crée un nouveau process et duplique le processus
appelant
rax (qui stocke la valeur de
retour de fork)
Une autre manière de représenter un processus est de séparer le flux d’exécution et les ressources du processus


int pthread_create(pthread_t *thread,
const pthread_attr_t *attr,
void *(*start_routine) (void *),
void *arg);start_routine(arg)attr (in): attributs du thread à créerstart_routine (in): adresse de la fonction à exécuter
par le nouveau threadarg (in): paramètre à passer à la fonction
start_routinethread (out): identifiant du thread crééUn thread se termine quand
void pthread_exit(void* retval)void* thread_function(void* arg) {
...
if(...) {
...
pthread_exit(NULL); // fin du thread
}
...
return NULL; // fin de thread_function, donc destruction du thread
}
tid.*retval