Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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); }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote