s_match "searchString" < inputFile
The two parameters are an input file with the source and the string to search the source for. You can assume search strings will be no longer than 80 characters. Searches should be parallelized to threads where each thread operates on a different memory block (not necessarily terminated by a newline). The number of matches per block (partial result of a thread) may be stored in a global array that is aggregated in the main thread (after joining with other threads) to produce a final result number.The following information may be useful:
This is some test text with the word foo\n Block
two times. Once at the beginning and fo1
-----------------------------------------------------------
o again there.\n Block
2
In this case our search string, "foo", starts on line 2 and ends on line 3.
Padding may be necessary in the final block, you should handle this.
Example
s_match "Linux kernel" < p3.in > p3.out
Sample Input: p1.in
Sample Output: p1.out