Question: Task 1 - Implement a bounded buffer. This will be a buffer of pointers to Matrix structs ( records ) . The datatype should be

Task 1- Implement a bounded buffer. This will be a buffer of pointers to Matrix structs (records). The
datatype should be Matrix ** bigmatrix, and the bounded buffer will be limited to
BOUNDED_BUFFER_SIZE size. Note: the demo code has it in the pcmatrix.c and similar idea can be
borrowed.
Task 2 Implement get() and put() routines for the bounded buffer.
Task 3 Call put() from within prod_worker() and add all necessary uses of mutex locks, condition
variables, and signals. Integrate the counters.
Task 4 Call get() from within cons_worker() and all necessary uses of mutex locks, condition variables,
and signals. Integrate the counters. Implement the matrix multiplication by consuming matrices from
the bounded buffer as described above.
Task 5 Create one producer pthread and one consumer pthread in pcmatrix.c to launch the parallel
matrix production and multiplication.
Tasks 6- Once a 1 producer and 1 consumer version of the program is working correctly, refactor
pcmatrix.c to use an array of producer threads, and an array of consumer threads. The array size is
numw. (Extra credit for correct implementation of 3 or more producer/consumer pthreads).

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!