Project in C programming -- 2
Budget: $30 – $250 USD
Project Specification
---------------------
1) This second project is a variation and extension of the pthread summation.
In your second project you will design and implement a POSIX pthreads multithreaded program that, when executed, has a main program
thread, 16 worker child pthreads, and each of the 16 worker child pthreads has its own 3 worker computation child (that is, grandchild of
the main) pthreads.
Overall, you have 1 main program thread, 16 worker child pthreads, and 48 worker computation pthreads.
2) The input file has 16,000 numbers. Your main program thread will open and read the input file into a 16,000 element integer array
called InpArray. Each of the 16 worker child pthreads will be responsible for processing its own 1,000 number segment of this integer
array as we saw in the lectures for data parallelism.
3) However, what is different in this project from the lectures is that each of the 16 worker child pthreads will make available the
geometric average (the nth root of the product of n numbers), the arithmetic average, and the sum for its 1,000 number segment (of
the InpArray) to the main program thread. Please note that the worker child pthreads do not actually do the computations themselves.
Instead, the 3 worker computation child pthreads (grandchildren) will do the computations while the worker child pthread (the parent)
just simply waits for the computations to be completed.
That is, the first worker computation child pthread determines the geometric average computation, the second worker compuutation child
pthread does the arithmetic average, and the third worker computation child pthread does the sum computation.
When each worker child pthread has received its 3 results from the worker computation child pthreads, the worker child pthread (parent)
will make these results available to the main program thread using global array(s) and then terminate.
After all of the 16 worker pthreads have terminated, the main program thread will compute and provide output for:
a) The maximum of the 16 geometric average numbers
b) The maximum of the 16 arithmetic average numbers
c) The maximum of the 16 sum numbers
Your program execution and command line arguments follows this syntax to provide requested output file for the one input file given on
the command line:
./MYLASTNAME_MYSTUDENTID.exe INPUT_FILE OUTPUT_FILE
---------------------
1) This second project is a variation and extension of the pthread summation.
In your second project you will design and implement a POSIX pthreads multithreaded program that, when executed, has a main program
thread, 16 worker child pthreads, and each of the 16 worker child pthreads has its own 3 worker computation child (that is, grandchild of
the main) pthreads.
Overall, you have 1 main program thread, 16 worker child pthreads, and 48 worker computation pthreads.
2) The input file has 16,000 numbers. Your main program thread will open and read the input file into a 16,000 element integer array
called InpArray. Each of the 16 worker child pthreads will be responsible for processing its own 1,000 number segment of this integer
array as we saw in the lectures for data parallelism.
3) However, what is different in this project from the lectures is that each of the 16 worker child pthreads will make available the
geometric average (the nth root of the product of n numbers), the arithmetic average, and the sum for its 1,000 number segment (of
the InpArray) to the main program thread. Please note that the worker child pthreads do not actually do the computations themselves.
Instead, the 3 worker computation child pthreads (grandchildren) will do the computations while the worker child pthread (the parent)
just simply waits for the computations to be completed.
That is, the first worker computation child pthread determines the geometric average computation, the second worker compuutation child
pthread does the arithmetic average, and the third worker computation child pthread does the sum computation.
When each worker child pthread has received its 3 results from the worker computation child pthreads, the worker child pthread (parent)
will make these results available to the main program thread using global array(s) and then terminate.
After all of the 16 worker pthreads have terminated, the main program thread will compute and provide output for:
a) The maximum of the 16 geometric average numbers
b) The maximum of the 16 arithmetic average numbers
c) The maximum of the 16 sum numbers
Your program execution and command line arguments follows this syntax to provide requested output file for the one input file given on
the command line:
./MYLASTNAME_MYSTUDENTID.exe INPUT_FILE OUTPUT_FILE