Question: Writhe the pseudocode to solve the matrix problem. 1 . int data [ 3 ] [ 3 ] records a 3 by 3 matrix. 2

Writhe the pseudocode to solve the matrix problem.
1. int data[3][3] records a 3 by 3 matrix.
2. You need to create three worker threads by call pthread_create in the main function.
3. The first-created worker thread calculates the sum in the first line of the matrix; the second-created worker thread calculates the sum in the second line of the matrix; and The third-created worker thread calculates the sum in the last line of the matrix.
4. The main function receives the result of each line from a worker thread and prints total sum.
5. Synchronize the worker thread and the main function.
In your pseudocode, you need to clearly specify the input arguments in pthread_create. You also need to clearly indicate the sem_init, sem_wait and sem_post if you use semaphore in your pseudocode.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!