Question: Everything be clear that fulfill all the requirments. please Code is here /* * c_pthread_hello.c * * Created on: Aug 29, 2019 * Author: qcheng1

Everything be clear that fulfill all the requirments. pleaseEverything be clear that fulfill all the requirments. please Code is here

Code is here

/* * c_pthread_hello.c * * Created on: Aug 29, 2019 * Author: qcheng1 */

#include #include #include

int thread_count;

void * hello(void * rank);

int main(int argc, char* argv[]){ long thread; pthread_t* thread_handlers;

thread_count = strtol(argv[1], NULL, 10); thread_handlers = malloc(thread_count * sizeof(pthread_t));

printf("Create pthread_t data structure"); for (thread = 0; thread

printf("Hello from main thread ");

for (thread = 0; thread

free(thread_handlers); thread_handlers = NULL;

return 0; }

void* hello(void* rank){ long my_rank = (long)rank;

printf("Hello from thread %ld of %d ", my_rank, thread_count);

return NULL; }

2. Use an IDE (Visual Studio, or editor in the Ubuntu virtual machine, or editor in school cluster mamba.urc.uncc.edu). Compile the c code: gcc -g -Wall-o c_pthread_hello c_pthread_hello.c -Ipthread Run the code: ./c_pthread_hello 3. Explain to your team member(s) about the compiling command and execution command. 4. Execute the code for five times. What do you observe? https://uncc.instructure.com/courses/119982/assignments/815014 1/2 2/3/2020 Lab: Shared-memory Parallelism through PThreads (Part 1) 5. Copy the c_pthread_hello.c to another file. Adapt the code to mimic your team. Main thread displays the class title; each thread displays the team member name (it is okay to hard coding title and member name in the subquestion) 6. Submit your code in canvas. 2. Use an IDE (Visual Studio, or editor in the Ubuntu virtual machine, or editor in school cluster mamba.urc.uncc.edu). Compile the c code: gcc -g -Wall-o c_pthread_hello c_pthread_hello.c -Ipthread Run the code: ./c_pthread_hello 3. Explain to your team member(s) about the compiling command and execution command. 4. Execute the code for five times. What do you observe? https://uncc.instructure.com/courses/119982/assignments/815014 1/2 2/3/2020 Lab: Shared-memory Parallelism through PThreads (Part 1) 5. Copy the c_pthread_hello.c to another file. Adapt the code to mimic your team. Main thread displays the class title; each thread displays the team member name (it is okay to hard coding title and member name in the subquestion) 6. Submit your code in canvas

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!