Processus -utiliser la fonction wait
hannaria
Messages postés
23
Statut
Membre
-
hannaria Messages postés 23 Statut Membre -
hannaria Messages postés 23 Statut Membre -
hi!!
please ...can u helpe me to solve this 2 question
1-Editer le programme . Compilez-le puis éxécutez-le en tâche
de fond : utiliser la commande : $./a.out &
Quel est l'état du processus fils (pensez à utiliser la commande ps avant la
terminaison du process père)
2. Proposer une solution pour éviter les états orphelin et zombie en
utilisant la fonction wait.
#include <stdio.h>
#include <stdlib.h>
int main(){
pid_t pid;
pid=fork();
if (pid == 0) {
printf ("je suis le fils, mon pid est %d, le pid de mon pere est %d \n",getpid(),getppid() );
exit(0);
}
else {
sleep(5);
printf ("je suis le père , mon pid est %d, le pid de mon fils est %d \n", getpid(), pid);
exit(0);
}
return 0;
}
please ...can u helpe me to solve this 2 question
1-Editer le programme . Compilez-le puis éxécutez-le en tâche
de fond : utiliser la commande : $./a.out &
Quel est l'état du processus fils (pensez à utiliser la commande ps avant la
terminaison du process père)
2. Proposer une solution pour éviter les états orphelin et zombie en
utilisant la fonction wait.
#include <stdio.h>
#include <stdlib.h>
int main(){
pid_t pid;
pid=fork();
if (pid == 0) {
printf ("je suis le fils, mon pid est %d, le pid de mon pere est %d \n",getpid(),getppid() );
exit(0);
}
else {
sleep(5);
printf ("je suis le père , mon pid est %d, le pid de mon fils est %d \n", getpid(), pid);
exit(0);
}
return 0;
}
A voir également:
- Processus -utiliser la fonction wait
- Fonction si et - Guide
- Comment utiliser chromecast sur tv - Guide
- Utiliser iphone comme webcam - Guide
- Comment utiliser teamviewer - Guide
- Utiliser tablette comme deuxieme ecran - Guide
the problem is that in my class we did not study yet (the fonction wait.....and etat of processus)...... we are in holiday and i tray alone to study them..this whay i ask u this (may be for u) a stupid question
so in order of that let me ask my question by other way
when we use the foction wait???
and how can i knew that the child is orphan or zombie???
For the function wait(), you have already asked the question in another post. So, thanks for not asking the same question twice.
And then, here French is spoken.
Kind regards,