Question: A. (10 points) Your program creates a single child process, printing at least one message from both the parent and child process indicating the PIDs

A. (10 points) Your program creates a single child process, printing at least one message from both the parent and child process indicating the PIDs of those processes. Your parent process should wait for the child to terminate and print a message once the child has completed.

B. (+5 points) Your program creates multiple child processes without using a loop, printing messages at the start and end of each process as described in part A.

C. (+10 points) Your program uses a loop to create ten (10) child processes, printing messages at the start and end of each process as described in part A.

D. (+5 points) Your program is almost identical to part C, but the number of child processes is based on a command line argument passed to your executable. (For example, if your executable is named proj1, executing the command ./proj1 6 will run a version of your program that creates 6 child processes. Assume the maximum number of child processes is 25.

E. (+10 points) Your program is almost identical to part D, but the program is able to discern when each of its child processes completes and print an appropriate message. (For example, when the first child process completes, print a message saying, "Child 1 (PID xxxxx) finished", where xxxxx would be replaced by the actual PID.

F. (+5 points) Your program is almost identical to Part E, but each child process starts a new program, replacing the address space of the parent process with that of the new program. For this part, all child processes should start the same program.

G. (+5 points) Your program is almost identical to Part F, but each child process starts one new program from a set of five possible new programs. Source code for the new programs is on the website.

The five test programs are as follows: 1. test1.c: Prints values from 0 to 4, along with the square of each value. 2. test2.c: Calculates and prints the square root of the PID. 3. test3.c: Determines whether the PID is odd or even. 4. test4.c: Calculates and prints the number of digits in the PID. 5. test5.c: Uses a recursive quicksort function to sort an array of ten integers.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!