Question: Q2- Write a C++ code that utilizes the PTHREAD library to synchronize the action of three threads trying to perform matrix-matrix multiplication. Thread_1 is responsible

Q2- Write a C++ code that utilizes the PTHREAD library to synchronize the action of three threads trying to perform matrix-matrix multiplication. Thread_1 is responsible for multiplying even-indexed cells, Thread_2 is responsible for multiplying odd-indexed cells and Thread_3 sums up the results obtained by Thread_1 and Thread_2. You should display the total execution time of your program using chrono library. You must use the following parameters: 1. Barriers are the main synchronization primitive you should use. 2- You must use the PTHREAD library to implement the actions of threads creation, synchronization, sleeping, .... 3- The size of the input matrices is a user input, and your implementation must verify the sizes and prompt the user in case of size error. The input matrices are of size 1000x1000 at least. Deadline: 31-12-2020 @ 1PM no extension will be given
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
