Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You will be using Linux shared memory to solve the following problem by a program comprising concurrent processes. Matrix Multiplication: Matrix multiplication is a computation
You will be using Linux shared memory to solve the following problem by a program comprising concurrent processes. 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 four processes that computes the product of two 4 x 4 matrices of integers. The parent process will fork four child processes P1, 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 matrix Q. Note that the following formula is used to compute the element stored in row i and column k of Q: Q[i,k] = {4}=1 M[i,j] * N [j,k] Input: For this assignment you will need to put 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 row followed by the row number of Q it is dealing with. Your Job: (1) Write a program in C running under Linux to solve this problem. You will have to use Linux shared memory for storing the matrices. You will be using Linux shared memory to solve the following problem by a program comprising concurrent processes. 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 four processes that computes the product of two 4 x 4 matrices of integers. The parent process will fork four child processes P1, 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 matrix Q. Note that the following formula is used to compute the element stored in row i and column k of Q: Q[i,k] = {4}=1 M[i,j] * N [j,k] Input: For this assignment you will need to put 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 row followed by the row number of Q it is dealing with. Your Job: (1) Write a program in C running under Linux to solve this problem. You will have to use Linux shared memory for storing the matrices
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