10.5. Lab - Multithreaded Programming - Matrix MultiplicationΒΆ

  • Based on the documentation and sample code in Multi-threaded Programming, write a multi-threaded application to multiply two matrices.

  • The product $C$ of matrices $A$ (M rows and K columns) and $B$ (K rows and N columns) is a matrix of M rows and N columns.

    C = A \times B

    The individual values of $C_{i,j}$ are calculated as:

    C_{i,j} = \sum_{n=1}^{K} A_{i,n} \times B_{n,j}

  • Define matrices A, B and C as global two dimensional arrays or lists (for Python).

  • Create a tread to calculate each term of C. For safety, use a simple locking mechanism to control each thread writing to the global array, C.

  • Submit a short lab report as a plain text file explaining what you did in the activity and what you learned from doing it. Include your source code in your assignment submission.

  • K-State Online Multi-threaded Application Submission Page