CS 110 Intro to Computer Systems
Fork Project
Version 1.00
Due 21 September, Friday, 9 PM
10 Points


Using the figure handed out in class, write a small program (C/C++) that has a parent and child process. The parent process forks the child, then calls a function which prints out the parent and child process id (with a tag indicating which pid is which). The parent then waits for the child to complete.

Once forked, the child calls a function which sleeps for a period of seconds where the sleep time in seconds is (command line) input as a startup parameter to the program (data sharing between parent and child). Once the child wakes up, it prints out the date (do not use system to do the date, but find the underlying OS system call) and terminates. The printout should delineate between parent and child.
If you have problems with I/O, then make sure to flush.

What to Turn-in and Submit

Last modified Sept 25, 01 by mike@cs.hmc.edu