Score on this assignment:
parallel code: 16
serial code: 15
int main(argc, char *argv[]) {
int x[argc -3];
if (argc < 4)
return 0;
...
for ( ... ) {
pthread_create(...);
pthread_join(...);
}
If should be:
for ( ... )
pthread_create(...);
for ( ... )
pthread_join(...);
lock mutex
searchForTwoStrings
print results
unlock mutex
If should be:
searchForTwoStrings
lock mutex
print results
unlock mutex
for ( ... ) {
ptr = malloc( ... );
...
}
...
free(ptr);
exit(0);
Freeing is not necessary if the process is terminating.