CS520
Spring 2013
Laboratory 9
Friday April 5
The lab must be submitted prior to 8am on Saturday April 6.


The goal for this lab is to complete a multithreaded solution to the problem given in Program 4.

Perhaps the simplest solution is to create a set of threads, one for each input file, with each thread analyzing its own file. Have the main thread use pthread_join to wait for the other threads to finish. When the threads complete, then have the main thread combine the results into a single answer.

Points will be awarded in the following way:

  1. (40 points) Be able to correctly handle a single file. This version will only need to have one thread running at a time, since the main thread will create only a single thread to analyze the single file.

  2. (60 points) Be able to correctly handle multiple files. This version will have multiple threads running at the same time analyzing the multiple files.

valgrind can be a useful tool when debugging multithreaded programs. Use its helgrind component: valgrind --tool=helgrind a.out.

Turn in this laboratory by typing:

% ~cs520/bin/submit lab9 prog4.c

Submissions can be checked by typing:

% ~cs520/bin/scheck lab9

Remember that there are no late submissions of labs. Submit what you have prior to 8am on Saturday April 6.


Last modified on March 26, 2013.

Comments and questions should be directed to hatcher@unh.edu