Question: Write a C or C++ program that used pthreads to harness multiple cores and improve performance for a program that can count the occurrences of

Write a C or C++ program that used pthreads to harness multiple cores and improve performance for a program that can count the occurrences of a given character in an input file by reading the input file into an array and using threads to do the counting. You can assume a maximum size for the input file (and use a fixed size array). Your homework page will include a link to the input file. Input will include the search character, the number of threads to use, and the name of the input file. Output will include the search character, the number of threads to use, the name of the input file, the number of times the search character was found in the file, and the execution time for the program (using gettimeofday). Your homework page will show outputs for 1-4 threads, searching for the same character in the linked input file.

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!