Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your Task: In assignment 1, your task is to design and implement a program to use the trapezoidal rule to approximate the integral of the
Your Task: In assignment 1, your task is to design and implement a program to use the trapezoidal rule to approximate the integral of the following function. rdx J 1 + x2 by using N processes to sum up n trapezoids. N should vary in the range of 1 to 8, while n = 32. If you have not completely forgotten about what you learned in Calculus, we have dx arctan 1 - arctan 0 = 1 + x2 7 = ar A J The Trapezoidal Rule for approximating S f (x) dx is given by f (x) dx = In = (f (x0) + 2f (21) + 2f (42) + ... + 2f (Xn-1) + f (en)], b-a where Ax = and Xi = a +iAr. Algorithm: The controller (parent) 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 32 results, it prints out the final answer, which should be within a reasonable range of 0.7850 (i.e., 7/4)
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