Project parameters:
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 preliminary programming test in parallel.
Detailed Requirements:
Spawn exactly two child processes, one is to run testspecial program and the other is to run testalphabet program; 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!"
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 !"
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/TA 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.
Directions to complete your assignment
Double check you have successfully completed programming assignment#0 and two executable files testalphabet and testspecial are generated under zero folder on edoras Copy one.zip from the shared folder cs480-02 on Edoras server to programming folder Unzip the zip on edoras using the commands: unzip one.zip
so you will have one more folders: one (source files) under programming directory on edoras machine
Copy two executable programs: testalphabet and testspecial from your folder zero to folder one Modify source files under folder one to complete this assignment. Test your program to make sure it works correctly. Re-test your program following the commands provided above and record the terminal session to Test.log Write README file to explain your code and include your test result How to submit your assignment
The source files under the one folder on edoras machine will be considered for grading. Please finish your coding by 11:59pm July 16th and make sure your program must execute correctly on edoras. In addition, you also need to do canvas submission by adding a text saying "programming assignment#1 has been submitted and ready for grading". -5 points if missing the text in canvas submission. Your grading may be started immediately after the deadline unless notice otherwise, so please make your files ready by the deadline. If you plan to submit late with penalty, please let TA know before the due date. Excuses of “but it worked on my machine” will not be accepted, so if you develop elsewhere, plan to leave time for any migration problems that might arise.