Question: Update the code( given below ) to support tree-structure parallelism with an efficient barrier mechanism. convert the serial code into POSIX threads using C language

Update the code(given below) to support tree-structure parallelism with an efficient barrier mechanism.

convert the serial code into POSIX threads using C language

code is givern below at end.

Pi () is one of the most important and fascinating numbers in mathematics. Roughly 3.14, it is a constant that is used to calculate the circumference of a circle from that circle's radius or diameter. It is also an irrational number, which means that it can be calculated to an infinite number of decimal places without ever slipping into a repeating pattern. This makes it difficult, but not impossible, to calculate precisely. Let us use the calculation of the number pi answer these above-mentioned questions via POSIX Threads shared-memory approach.

Update the code(given below) to support tree-structure parallelism with an efficient barrier Please download the .c code which implements its serial algorithm of computing the pi. In terminal, run gcc -o computingPi CCalPi.c Then 1. Copy CCalPi.c as CCalPi_pthreads.c 2. Update the CCalPi_pthreads.c to support tree-structure parallelism with an efficient barrier mechanism.Including the pseudo code

CODE:

#include #include

double computingPiSerial();

int main(void) { double sum = computingPiSerial(); printf("Pi is equal to %f ", sum);

return EXIT_SUCCESS; }

double computingPiSerial(){ double sum = 0; double factor; long i, n = 100000;

for (i = 0; i

sum = sum + 4 * factor / (2*i+1); } return sum; }

pi = 4 (-1). pi = 4 (-1)

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!