Question
Please must read all the question before implementing the question and read bold areas to clear. Pi () is one of the most important and
Please must read all the question before implementing the question and read bold areas to clear.
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.
Write a brief report, including the pseudo code and giving an explanation why you choose the method.
Please view the code in the below.
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.
Write a brief report, including the pseudo code and giving an explanation why you choose the method.
CODE
#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): 2.1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started