Process and Signal homework:
Write a program that forks to create a child. The parent should wait for the child to complete. The child should run the ls command (using a system call that does not run in the background - no &) The child should print "bye from child" and then exit with code 55. The parent should then print "good exit" if the child's exit code is 55 and "bad exit" if the exit code is anything else.
You may find these samples helpful:
wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/fork1.c |
wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/fork1a.c |
In class, we will extend the project to do this, but it is not part of the homework:
Write a program that forks to create a child. The child should run the ls command (using a system call) and then pause for the parent to send a SIGUSR1 signal. The parent should ask the user to press enter. When the user presses enter, the parent should send a SIGUSR1 signal to the child. The child should print "bye from child" and then end.