Solving a problem using multi-threading You have to write two versions of progra
ID: 3938399 • Letter: S
Question
Solving a problem using multi-threading
You have to write two versions of program in c programming, one using PThread, one using OpenMP.
The program shall take two array as input. Each input array contains a list of unsorted duplicated integers with size up to 1GB-2GB per one . The number of the thread used should also depend on your input.
The job of the program is to output a sorted list of unique integers that are common between
the two array into a file
Please provide completed c source code. Thank you so much!
For example:
Input:
2 1 0 8 8 6 1 5 7 0
4 3 2 9 0 2 6 5 2 2 3 1 1 1 1
Output:
0
1
2
5
6
Explanation / Answer
#include #include #include void *myThreadFun(void *vargp) { sleep(1); printf("Printing GeeksQuiz from Thread "); return NULL; } int main() { pthread_t tid; printf("Before Thread "); pthread_create(&tid, NULL, myThreadFun, NULL); pthread_join(tid, NULL); printf("After Thread "); exit(0); }Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.