Question: Using Linux. multi threading and multi processing. This has to be done through the command window or terminal. Please also explain how you arrived at

Using Linux. multi threading and multi processing. This has to be done through the command window or terminal. Please also explain how you arrived at your answer.Using Linux. multi threading and multi processing. This has to be donethrough the command window or terminal. Please also explain how you arrived

Create a program (matrix.c) in C to multiply two matrices in the following fashion: a. The main process (parent process) will create multiple child processes. Each child process will solve part of the matrix multiplication problem in the following way: Given two matrices A and B: 7 2 3 4 5 6 11 12 A= B= 58 64 139 154 The result of A x B is: Where: 58 = (1 x 7) + (2 x 9) + (3 x 11) //first row of A, first column of B 64 = (1 x 8) + (2 x 10)+(3 x 12) //first row of A, second column of B 139 = (4 x 7) + (5 x 9) +(6x 11) 1/ second row of A, first column of B 154 = (4 x 8) + (5 x 10) + (6 x 12) /second row of A, second column of B The work required to perform this multiplication can be divided in 2 parts (1 part per row in the final matrix). Each part will be assigned to a different child process. The first child will compute the result of (1 x 7) + (2 x 9) + (3 x 11) and (1 x 8) + (2 x 10) + (3 x 12), and so on. Note that the final result can be constructed from the partial results. In general, you will create as many child processes as the number of rows in A x B. b. Each child process will send its partial results to the parent process. The communication should be implemented using pipes. c. The parent process will construct the final result using the partial results received from all the children. Use the following code as a starting point for your solution (matrix.c). #include #include #include #include /*pid_t */ #include /*wait */ #define M 2 #define N 3 #define 0 2 int main() { //example matrices int matrix1[M] [N] = {(1,2,3}, {4,5,6) }; /'M rows x N columns/ int matrix2[N][0] = {(1,2), (3,4}, {5,6} }; /* NXO */ int Product[M] [O]; /* MXO */ //declaration and creation of pipes //matrix multiplication printf("The matrix product is: "); 1/Print the result (product) return; ) Your final solution should support any set of correct values for M, N, and O (number of rows and columns of the matrices). A suggested approach is to solve the problem for the specific values of M, N, and 0 (number of rows and columns) provided in the initial code. When you have a correct solution for this case, extend your code to support matrices with different values of M, N, and O

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!