PURPOSE

This assignment intends to familiarize you with system calls such as fork, exec, wait, exit and etc., to spawn and terminate other user programs.

ASSIGNMENT

This assignment builds on programming assignment#0, so you must have two executable files ready: testalphabet and testspecial under ~/programming/zero folder before taking this assignment.

You will be provided two new files:

makefile
mulproc.c

Your assignment is to write code in mulproc.c to fork two child processes running the two programs testalphabet and testspecial generated in programming assignment#0 in parallel.

Detailed Requirements:

1) Spawn exactly two child processes, one is to run testspecial program and the other is to run testalphabet program;

2) When a child process starts executing a program, print a message to the output screen showing which child process (with PID) is running this program (with program name), for example:

"CHILD < PID: 16741> process is executing testalphabet program!"

3) When one child process finishes executing a program, this child process should be terminated, and at the same time, a message should be print to the output screen showing which process (with PID) is done with this program (with program name), for example:

"CHILD < PID: 16741> process has done with testalphabet program !"

4) The messages should match the real execution orders, i.e. when the testspecial program starts/ends, the right message should pop up immediately. Hence, you need to track the starting/ending point of each child process.

The expected screen printing should be similar as follows:

CHILD < PID: 16741> process is executing testalphabet program!
CHILD < PID: 16742> process is executing testspecial program!
, -> 745668
. -> 798072
... ...
CHILD < PID: 16742> process has done with testspecial program! See the results
above!
a -> 2973036
b -> 556908
... ...
CHILD < PID: 16741> process has done with testalphabet program! See the results above!

Note: Feel free to do any change of the file (fill the code, create new functions and etc). You also can create new .h and .c files (but I don't think you really need).

Your program must execute correctly on Edoras machine, the instructor will type the following commands to test your code:

make// generate executable file mulproc
./mulproc // two child processes will be generated to run testspecial and
testalphabet programs as stated above.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.