include include int main clockt begin clock double x double
#include #include int main() clock_t begin = clock(); double x; double sum; for (x =-1e10; x
Solution
#include<stdio.h>
#include<conio.h>
#include<time.h>
int main()
pthread_t my_thread;
void *function_thread()
{
clock_t begin = clock();
double x, sum;
for (x= (-1e10*2) ; x<(1e10*2);x++)
{Sum = sum + 1e-10;}
clock_t end = clock();
double exec_time = (double)(end-begin)/CLOCKS_PER_SEC;
printf(“sum %f execution time : %f\ ”,sum,exec_time);
}
//loop to call the thread function 4 times .
for(int i=1;;i<=4;i++)
{
pthread_create(&my_thread[i],NULL,,&function_thread,);
}
}
