Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You will be using Linux shared memory to solve the following problems by programs comprising Matrix Multiplication: Matrix multiplication is a computation intensive problem when
You will be using Linux shared memory to solve the following problems by programs comprising Matrix Multiplication: Matrix multiplication is a computation intensive problem when the matrices are large and is often achieved by concurrent programming. In this assignment you will focus on a scaled-down version of the problem. You have to write a concurrent program consisting of multiple processes that computes the product of two 4 x 4 matrices of integers. (Part 1) The parent process will fork four child processes PI, P2, P3, P4. The computation of the product is to be done by all the four processes P1.. P4 that run concurrently on the system. All the matrices are to be stored in shared memory that is accessed by the processes. The two input matrices M and N hold the input data where as a third matrix Q is used to store the result. Each process Pi (i=1..4) is responsible for computing the values to be stored in row i of the matrix Q. Note that the following formula is used to compute the element stored in row i and column k of Q Input: For this assignment you will need to put (hardcode) the input data for matrices M and N inside the program itself That is, the program should initialize matrix M and N with a given set of data values. Output: (i) After the computation of the result matrix Q is complete any one of the processes has to print out M N and Q (ii Each child Process Pi should print out "Child Process: working with ow followed by the row number of Q it is dealing with. Yout Job: Write a program in C running under Linux to solve this problem. The program should ensure that all the four proecesses are completed before the program completes (exits). The wait) system call can be used for ensuring this. Testing: Test your program thoroughly with a number of different sets of data values. ong with oth Mandatory Test Data M-1 2 3 4 5 6 7 8 4 3 21 876 5 N-13 5 7 24 6 8 73 5 7 8 6 4 2 NOTE: Recall that you will need to put (hardcode) the input data for matrices M and N inside the program itself. The must conatin the madatory test data (for M and N) given above
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