Question: Lab3.c #include 2. #include 3. #include 4. #include 34. clock_gettime(CLOCK REALTIME, &time_2); 35 36, exec-tne = (time-2. tv-see-time-1. tv-sec); 37. exec time exec tine(tine_2.tv nsec

Lab3.c

 Lab3.c #include 2. #include 3. #include 4. #include 34. clock_gettime(CLOCK REALTIME,&time_2); 35 36, exec-tne = (time-2. tv-see-time-1. tv-sec); 37. exec time exectine(tine_2.tv nsec tine_1.tv_nsec)/1.0e9; 38 39.info-exec.tine-exec time; 40 41. pthread exit (ULL) 6.

#include 2. #include 3. #include 4. #include 34. clock_gettime(CLOCK REALTIME, &time_2); 35 36, exec-tne = (time-2. tv-see-time-1. tv-sec); 37. exec time exec tine(tine_2.tv nsec tine_1.tv_nsec)/1.0e9; 38 39.info-exec.tine-exec time; 40 41. pthread exit (ULL) 6. struct thread_ info ( int maxitr; double exec time; 10 11. typedef struct thread_info thread_info t; 12 13. void *func (void *arg) 14. 15 16 17 18 19 20 21. 45. int main(void) struct timespec time_1, time_2; double exec time; thread_info t info int i, maxitr; volatile double a, b, c; 47. pthread_t thread1; 48. thread info t infol; 49. double maxitr; 51, maxitr = 5.0e8 info - (thread_info_t *)arg; max itr = info->maxitr; infol.maxitr = (int)Taxitr; 53. 54 55. 56 57 23. 24 25 26. 27. 28 29 30 31. 32. if (pthread_create(&thread1, NULL, &func, kinfo1) != 0) { b= 2.3; c 4.5; printf("Error in creating thread 1n); exit(1); exec time-0.0 59 60. pthread join(thread1, NULL); 61. printf ("Exec time for thread secn", infol.exectime); clock_gettime(CLOCK_REALTIME, &time_1) for (i = 0; i 2. #include 3. #include 4. #include 34. clock_gettime(CLOCK REALTIME, &time_2); 35 36, exec-tne = (time-2. tv-see-time-1. tv-sec); 37. exec time exec tine(tine_2.tv nsec tine_1.tv_nsec)/1.0e9; 38 39.info-exec.tine-exec time; 40 41. pthread exit (ULL) 6. struct thread_ info ( int maxitr; double exec time; 10 11. typedef struct thread_info thread_info t; 12 13. void *func (void *arg) 14. 15 16 17 18 19 20 21. 45. int main(void) struct timespec time_1, time_2; double exec time; thread_info t info int i, maxitr; volatile double a, b, c; 47. pthread_t thread1; 48. thread info t infol; 49. double maxitr; 51, maxitr = 5.0e8 info - (thread_info_t *)arg; max itr = info->maxitr; infol.maxitr = (int)Taxitr; 53. 54 55. 56 57 23. 24 25 26. 27. 28 29 30 31. 32. if (pthread_create(&thread1, NULL, &func, kinfo1) != 0) { b= 2.3; c 4.5; printf("Error in creating thread 1n); exit(1); exec time-0.0 59 60. pthread join(thread1, NULL); 61. printf ("Exec time for thread secn", infol.exectime); clock_gettime(CLOCK_REALTIME, &time_1) for (i = 0; i

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!