Question: Part A: Computing PI With Threads The first part of this assignment is to explore the use of threads in an application that computes PI.

Part A: Computing PI With Threads The first part
Part A: Computing PI With Threads The first part of this assignment is to explore the use of threads in an application that computes PI. Download the compute_pi_montecarlo.c (compile: gcc compute_pi_montecarlo.c -o pi -Ipthread) (execute: /pi 80000 8) program to your Project3 subdirectory. Compile and run this program a few times to understand the basic operation and to verify that it does approximate PI. Next, time your program and/or add appropriate timing system calls to your code. Run the application varying the number of threads and number of sample points. You may get a core dump when you exceed the number of threads permitted (note that value). Record the time(s) it takes your program to execute when changing the number of threads and number of sample points. 1. Create a plot of time vs. number of threads when the number of sample points is fixed. 2. Create a plot of time vs. number of sample points when the number of threads is fixed. Use an Excel like application to create your plot. The name of this program must be osproj2a.c or osproj2a.cpp. Part B: Computing Fibonacci Numbers with Threads The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, .... Formally, it can be expressed as: fib, = 0 fib, = 1 fib = fib + fib.. Write a multithreaded program that generates the Fibonacci series using the pThreads library. This program should work as follows: The user will enter on the command line the number of Fibonacci numbers that the program will generate. The program will then create a separate thread that will generate the Fibonacci numbers placing the sequence in data that is shared by the

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 Mathematics Questions!