ajout fichiers
This commit is contained in:
20
TP2/Exemples/Exemple2.c
Normal file
20
TP2/Exemples/Exemple2.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
|
||||
int n = 5;
|
||||
pid_t fils_pid;
|
||||
|
||||
for (int i=0; i < n; i++) {
|
||||
fils_pid = fork();
|
||||
|
||||
if (fils_pid > 0) break;
|
||||
|
||||
printf("Processus %d avec père %d n=%d\n", getpid(), getppid(),i);
|
||||
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user