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.