Question: Please code this using C language and comment on each sections or lines to understand. The subject is Inter-process Communication which is used to approximate

Please code this using C language and comment on each sections or lines to understand. The subject is Inter-process Communication which is used to approximate the integral using trapezoidal rule. I really need help with this question. Thank you.

Please code this using C language and comment on each sections or

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. - da J1 +22 0 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 14.02 = [arctan x] = arctan 1 arctan 0 = - 0 = 5 2 -= arc cctan 1 - arctan 0 = J 1+ The Trapezoidal Rule for approximating S f(x) dx is given by f(x) dx Tn = f (x0) + 2f (x1) + 2f (22) + ... + 2f (xn-1) + f(xn), where Ax = ba and Xi = a +iAc. 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., 1/4). 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. - da J1 +22 0 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 14.02 = [arctan x] = arctan 1 arctan 0 = - 0 = 5 2 -= arc cctan 1 - arctan 0 = J 1+ The Trapezoidal Rule for approximating S f(x) dx is given by f(x) dx Tn = f (x0) + 2f (x1) + 2f (22) + ... + 2f (xn-1) + f(xn), where Ax = ba and Xi = a +iAc. 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., 1/4)

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