Question: with the help of code explain 2 and 3 questions I need clearly The monte-carlo approximation of works as follows: generated inside a square with




with the help of code explain 2 and 3 questions I need clearly
The monte-carlo approximation of works as follows: generated inside a square with side length 2. Second, the fraction of those points which are also inside a unit circle entirely inside the square is calculated. This fraction approximately equal to the fraction: [area of circle] / [area of square-m" / 4r2(r-1), The third step multiplies this fraction by 4 to estimate t. First, several random points are 2. Describe how the monte-carlo approximation of T can be altered to use multiple threads. Your solution must: Have each thread/process except one generate random points inside a square with a side length of 2, calculate the fraction of the points inside the unit circle, and store the result in an array Have the other thread/process average the fractions stored in the array and multiply by 4 Use exactly one semaphore. Use the semaphore to create a synchronization barrier so that the threads which generate random points and calculate fractions complete before the thread that averages those fractions begins its task. a. b. c. d. Explain (using a trace of execution) how starvation can occur using the corrected code for the readers-writers problem 3. tinclude
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
