Assignment title: Information
โโโ
Consider a matrix A of size ๐ร๐ and a matrix B size ๐ร๐พ. Let Ai,j and Bi,j respectively be the entry of matrix A and B at row i and column j. Assume each entry is an integer value. Let C be the matrix product of A and B, i.e., ๐ถ=๐ดร๐ต; recall that as the result, matrix C has M rows and K columns. Further, if Ci,j is the entry of matrix C at row i and column j, we calculate ๐ถ!,!= ๐ด!,!ร๐ต!,! ! !!! In other words, each Ci,j is the sum of the products of elements for row i in matrix A and column j in matrix B. For example, if A is a 3ร2 matrix, and B is a 2ร4 matrix, C would be a 3ร4 matrix, and C3,2 = ๐ด!,!ร๐ต!,!+ ๐ด!,!ร๐ต!,!. More specifically, given ๐ด=12 34 56 and ๐ต=1234 5678, we compute ๐ถ=๐ดร๐ต=1ร1+2ร5 1ร2+2ร6 1ร3+2ร71ร4+2ร8 ๐ร๐+๐ร๐๐ร๐+๐ร๐๐ร๐+๐ร๐๐ร๐+๐ร๐ 5ร1+6ร5 5ร2+6ร6 5ร3+6ร75ร4+6ร8 =1114 1720 ๐๐๐๐๐๐๐๐ 3546 5768 In this project, you are asked to compute matrix C and compute the sum of entries in matrix C, denoted as total, in parallel using M processes/threads. Specifically, (i) process i computes the K entries in row i of matrix C, and calculates the total value of the entries, denoted as subtotali for i = 1, 2, โฆ, M; (ii) the parent process/thread computes ๐๐๐๐๐=Operating Systems Parallel Matrix Multiplication Sum (PMMS) Objective The objective of this programming assignment is to give you some experiences in using multiple processes/threads and their inter-processcommunications respectively. You will learn how to create processes, shared memory and solve the critical section problems. ๐๐๐๐๐๐๐๐๐! !!! . In the example, process i = 2 computes the K = 4 bolded entries in matrix C, and subtotal2 = 23 + 30 + 37 + 44 = 134, and total = 62 + 134 + 206 = 402. of which computes subtotali, (ii) waits for the subtotal from each of the M child processes, (iii) computes ๐๐๐๐๐= ๐๐๐๐๐๐๐๐๐ ! !!! , and (iv) print each subtotal as well as total. For the example, the program prints the following output (xi is the process ID of process i): Subtotal produced by process with ID x1: 62 Subtotal produced by Processor with ID x2: 134 Subtotal produced by Processor with ID x3: 206 Total: 402 Let us call the executable for the parent process as pmms. The program should be run as: pmms matrix_A matrix_B M N K where matrix_A and matrix_B are the name of files that contain the entries of matrix A and matrix B respectively, and M, N, K specify the dimensions of the two matrices. For the example, the contents of the two matrices are as follows; the integers in each line are separated by a space. matrix_A matrix_B 1 2 1 2 3 4 3 4 5 6 7 8 5 6 The details of the implementation are as follow. 1) The parent process (i) reads the integers in files matrix_A and matrix_B, (ii) puts the entries in two 2-dimensional arrays A and B of size ๐ร๐ and ๐ร๐พ respectively, (iii) creates a two dimensional array C of size ๐ร๐พ, and (iv) creates a data structure named subtotal to store the subtotal generated by each child process and its process ID. The subtotal can store ONLY ONE (1) subtotal at a time. 2) The parent process (i) creates M child processes, and (ii) reads any available subtotal produced by each of the M child processes.