C project (pipes, implicit and explicit threading)
Budget: $30 – $250 USD
The base code is already present, you will have to work on implementing it in different ways( pipes, implicit threads and explicit threads.
B. You are going to write three parallel versions of the program you developed in Task 1. These
programs must determine the number of available CPUs on their own and can accept this
number as a command line argument (in case the user wishes to use different number of
threads).
Task 2: Write a parallel version of the program you implemented in Task 1 using processes (read
Chapter 9 and 10 of the Head First C book). Each worker process builds a hash table of one of the
parts. You must have an additional output process that prints the final output while receiving the
results via pipes from the worker processes. Measure the time that this program takes to process
all parts using the UNIX time utility. Save your solution as “task2.c.”
Task 3: Implement a parallel version of the program you implemented in Task1 with implicit
threads using “#pragma omp critical (mutex_name)” and “#pragma omp parallel for” from the
Open MP library. You must document your parallel design in the ReadMe file (mentioned under
submission details). Your code must be compiled using the “-fopenmp” option to allow you to use
the Open MP library for implicit threads. Your code must be compiled using the “-std=c11” option
to ensure that malloc and free are thread safe. Measure the time that this program takes to
process all parts using the UNIX time utility. Save your solution as “task3.c.”
Task 4: Implement a parallel version of the program you implemented in Task1 with explicit
threads using the pthread library (read Chapter 12 of the Head First C book). You must document
your parallel design in the ReadMe file (mentioned under submission details). Your code must be
compiled using the “-std=c11” option to ensure that malloc and free are thread safe; your code
must be compiled using the “-pthread” option to allow proper execution of multi-threads.
Measure the time that this program takes to process all parts using the UNIX time utility. Save
your solution as “task4.c.”
B. You are going to write three parallel versions of the program you developed in Task 1. These
programs must determine the number of available CPUs on their own and can accept this
number as a command line argument (in case the user wishes to use different number of
threads).
Task 2: Write a parallel version of the program you implemented in Task 1 using processes (read
Chapter 9 and 10 of the Head First C book). Each worker process builds a hash table of one of the
parts. You must have an additional output process that prints the final output while receiving the
results via pipes from the worker processes. Measure the time that this program takes to process
all parts using the UNIX time utility. Save your solution as “task2.c.”
Task 3: Implement a parallel version of the program you implemented in Task1 with implicit
threads using “#pragma omp critical (mutex_name)” and “#pragma omp parallel for” from the
Open MP library. You must document your parallel design in the ReadMe file (mentioned under
submission details). Your code must be compiled using the “-fopenmp” option to allow you to use
the Open MP library for implicit threads. Your code must be compiled using the “-std=c11” option
to ensure that malloc and free are thread safe. Measure the time that this program takes to
process all parts using the UNIX time utility. Save your solution as “task3.c.”
Task 4: Implement a parallel version of the program you implemented in Task1 with explicit
threads using the pthread library (read Chapter 12 of the Head First C book). You must document
your parallel design in the ReadMe file (mentioned under submission details). Your code must be
compiled using the “-std=c11” option to ensure that malloc and free are thread safe; your code
must be compiled using the “-pthread” option to allow proper execution of multi-threads.
Measure the time that this program takes to process all parts using the UNIX time utility. Save
your solution as “task4.c.”