3.1 Basic Processes

In C using UNIX system calls, write a program that demonstrates inter-process interaction. The program may spawn another process. We will refer to the first program as the "parent" and the second as the "child".

Each line of output of your parent process must be prefixed with PARENTA:  (if there was an argument) or PARENTB: (if there was not an argument). Each line of output of your child process must be prefixed with CHILD: . Prior to each step, your program must output an information line formatted as follows:

 About to perform step #.  

If your parent program receives an argument on the command-line, it must:

If your parent program does not receive an argument on the command-line, it must:

Your child program must:
  • Display a process information report.

  • Setup a signal handler with sigaction for the SIGTERM signal that replaces the child program with an instance of the parent program, without a command-line argument using execl.

  • Write a message to the inherited pipe, to synchronize with its parent.

  • Enter an endless loop that never returns.

The process information report must be in the following format:

Process ID is:            15550

Process parent ID is:     26778

Real UID is:              1004

Real GID is:              4000

Effective UID is:         1004

Effective GID is:         4000

Process priority is:      0

This information comes from getpid, getppid, getuid, getgid, geteuid, getegid, and getpriority.

Your program should have no other output.

Your repository must contain the following files:

This assignment will be graded based on its correctness and your ability to articulate why it is correct.