Question: Need this written in C, not c++ or c# CS 330 Prog 1: Basic Forking Your program, prog1.c, will demonstrate the use of the fork
CS 330 Prog 1: Basic Forking Your program, "prog1.c, will demonstrate the use of the fork and wait system calls on UnixLinux machines. The program should perform exactly 12 runs" before terminating. In each run, the program will create 26 child processes (say pA, pB,.. pY, pZ). Each process will print its character (AB', , Y, Z) once without newline before exiting, that's all the children will do. After creating the 26 children in each run, the parent (original process) will wait until all its 26 children have finished, then it will print a newline before going on to the next run or exiting. The output of this program, when properly implemented, will exemplity the unpredictable order in whichthe processes are scheduled to run. The two examples below are the output of the instructor's solution lf you've done the assignment correctly, your output should look similar; the formatting at least should be identical. BADFHGIEMJKRLCVPOXQUNYZWST ABDCGHEIOFKSLRVWQXUTPYNOZH BADCEHFGJIKMLNQOPTVURWSZXY ABDCEFHGJIMLKNQOPSTRWYXUZ ABCDGFHEJILMKNOQRPSUWTYvXZ ABEGFHIKJLMPOTRUVCSWXYDZQN ABCFHGILNMDOTEPWYUSZVQRXK ABCDFEGIJLKMNOQPRSTUWVZXYH ABDEGHJILKNMPORQUSTZVYXWCF BACDFEGHLM3NOQPSRTVUWYXZIK ABCDEFGHIJKMNOPQRSUTVWXYLZ ABEDFGHIJMKNLOPRQSCTVUWxYZ ABEDGFJILKMONPUQTYVRHSwcZX ABCDEGHIKMLNOQPSRVXUTJWYFZ ABDEGFH3ILKNMPOSQRUTVXWCYZ CAFDJKGLNOMPORTISWHYEXBUVZ ABEFGJIKLNOMPQRYWZVXUTDHSC ABCDFGHIJLKMONPORTSUXVWYEZ ABCDFGIH3LKNPMORQUSTVWEYXZ ABCEFGHIJLMKONQPSRTUVXYWDZ ABCDEFGIJKMLNPOQSRTUMVXYHZ Hint You do NOT need to track all 26 child PIDs to wait for them individually to complete. The wait (NULL) call completes when any single child terminates, returning the PID of the child. If no children are there any more to be 'waited" on, wait(NULL) retums-1. Waiting in a loop until -1 is returned will allow you to pause until all children have completed and have been reaped
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
