CS 284 Operating Systems
Programming Assignment #2

Due: 9/1/2001 - Class Time

Functions to examine using man pages:

  1. fork
  2. sleep
  3. msleep
  4. getpid
  5. getppid
  6. wait
  7. waitpid

 

Write a C program that performs a printf(..) describing all significant events during the execution of the following outline:
int main()
{
    announce what is my pid and my parent's pid
    fork a new process
    announce - was it successful?
    the new child process should
    {  announce its birth
        announce what is its pid and its parent's pid
        sleep a couple seconds
        announce its impending death
        exit
    }
    the parent should announce the creation of a child process
    announce the child's pid
    wait for the child to die                 
    announce

  1. the child's death
  2. the pid returned
  3. the status returned

    exit or return


}
=================================================================

You will use the 'script' command to capture all necessary information for handin.