Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions