and
2) How do you make the second-generation process sleep for 100 seconds and
do nothing else?
example of what I am trying to do is
#include <iostream.h>
#include <unistd.h>
int main(int argc, char *argv[]){
int parentPid, kidPid;
cout << "process start pid=" << getpid() << "\n";
parentPid = getpid();
kidPid=fork();
if (kidPid == 0)
cout << " I am the child process - " << getpid() << endl;
else
cout << "I am the parent process - " << getpid() << "\n";
return 0;
Please solve your trivial homework assignments yourself. At home.
>1) How would I make the first-generation process wait for its child to
>complete before exiting?
Do not transfer large parts of your posessions to the child before
your own death, and care for the education of the child. A well-educated
child will complete, becoming a worthy member of society, before you exit.
Of course, raising kids takes time, so be patient, and good at wait(0).
>2) How do you make the second-generation process sleep for 100 seconds and
>do nothing else?
You will find that a young second-generation child, does that by itself
quite regularly. You will even hear a loud warning sound after the sleep,
a feature not found with the boring, normal sleep(100)!
[X] This was a helpful answer.
[X] You have the right to understand.
[X] But, please, buy and read a good book on programming.
[X] Sorry an Alle fuer Englisch in einer deutschsprachigen Newsgroup...
best regards
Patrick