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.
1. You can assume a maximum size for the input file (and use a fixed size array).
2. Input will include the search character, the number of threads to use, and the name of the input file.
3. 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 system call).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started