Final Project

 

Due Date

See the calendar for due date.

Objectives:

Description:

Write a C program which accepts a single integer on the command-line. That integer is the number of pthreads that should be created by the original, main thread. The minimum number of threads to create will be 1 and the maximum number of threads to create will be 4.
Your program should be linked with the following object file:
~hcarroll/public_html/3240/private/final/finalProject-mysteryFunction.o
which contains a function named mysteryFunction(). This function takes an integer as an argument and returns an integer (that is >= 0). You may want to use finalProject-mysteryFunction.h.

The goal of your program is to evaluate mysteryFunction() for all integer arguments between 0 and 100 (inclusive), and to find the maximum return value. Evaluation of each argument will take several milliseconds, up to 0.1 seconds.
The main thread should wait for all the created threads to terminate. Then, the main thread should print the highest return value.
NOTE: Prior to the due date, mysteryFunction()'s highest return value will be 150, but after the due date, the highest return value could change.

Requirements:

  • Your program must compile and run on system64 with the following command:
    gcc -Wall -lpthread *.c ~hcarroll/public_html/3240/private/final/finalProject-mysteryFunction.o -o finalProject
  • Include a Makefile in your submission such that running make clean and make will correctly compile your code and produce an executable named finalProject.
  • Do not include spaces in directory names or file names.
  • For full credit, the outputs needs to match finalProject-answerKeyA.txt:
    The maximum value that mysteryFunction() returns is 150.
    

    Hints

    Submission

    Before submitting your final project, remove all object (.o) files (for example, with a make clean command). Make a gzipped tarball (.tgz) of the directory with your .c, and Makefilefiles. Submit your tarball at https://3240.cs.mtsu.edu/. For further instructions, please see the Miscellaneous page.

    Rubric:

    Points       Item
    ----------   --------------------------------------------------------------
    _____ / 10   Style
    _____ / 20   Creating Pthreads
    _____ / 10   Linking in mysteryFunction()
    _____ / 10   Wait for all the created threads to terminate
    _____ / 50   Correct maximum value
    _____ /  0   Compiles and runs on system64
    
    _____ /100   Total
    
    
    _____  Approximate number of hours spent