Question
Come up with a C program to use the trapezoidal rule 1 to approximate the integral of 2 x=0 1 x+1 dx, by using N
Come up with a C program to use the trapezoidal rule 1 to approximate the integral of 2 x=0 1 x+1 dx, by using N processes to sum up n trapezoids. N should vary in the range of 1 to 8, while n = 64.The controller process should create N ( [1, 8]), worker processes using fork() and other appropriate system calls, as you see fit. To facilitate the inter-process communication, there should be N pairs of pipes through which the controller assigns jobs to associated worker processes, and receives results back from them when the calculation is completed. More specifically, the controller process will initially assign the first N pieces to the N worker processes to do their respective calculation. Whenever a process has done its calculation of the area of another trapezoid, it will send it back to the controller. Upon receiving such a piece, the controller process will update the sum accordingly, and, if there are still un-calculated pieces, the controller will also assign the next piece to the just returned worker process. After the controller has received all the 64 results, it prints out the final answer, which should be within a reasonable range of 1.0986.
Step 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