CS332/Principles of Operating Systems/Spring 2007/Programming Project: Matrix Multiplication via a Multi-Threaded Program

The problem

Use pthreads to implement matrix multiplication (of 4x4 integer matrices). (This is the Project in Chapter 4 of Silberschatz, Galvin, and Gagne, pp. 149-151).

Matrix multiplication

A n-by-m matrix is a 2-dimensional array of numbers, with n rows and m columns. If A is an n-by-m matrix, and B is an m-by-p matrix, then we can take the matrix product C=AB. C is then an n-by-p matrix. The entries of C are sums of products of entries of A and B. In particular, the entry C[i][j] (row i and column j) is given by the formula
C[i][j] = A[i][0]*B[0][j] + A[i][1]*B[1][j] + ... + A[i][m-1]*B[m-1][j]

Program requirements

How to do it

To turn in your solution

A sample output of my solution

Input the 16 entries of the 4 x 4 matrix A: 1 2 3 4 0 -1 -2 -3 
7 8 -1 1 
5 10 -7 3
Input the 16 entries of the 4 x 4 matrix B: 9 1 0 0 
5 7 -5 -7
0 0 2 2
8 1 4 5
The matrix product of
  1   2   3   4 
  0  -1  -2  -3 
  7   8  -1   1 
  5  10  -7   3 
and
  9   1   0   0 
  5   7  -5  -7 
  0   0   2   2 
  8   1   4   5 
is
 51  19  12  12 
-29 -10 -11 -12 
111  64 -38 -53 
119  78 -52 -69 

How to run my solution

At the pegasus prompt, type
~loftin/public_html/op/project/solution

Due date: Monday, March 5, 2007