home page -> teaching -> parallel and distributed programming -> lab 2- producer-consumer synchronization

Lab 2 - Producer-consumer synchronization

Due: week 5.

Goal

Create two threads, a producer and a consumer, with the producer feeding the consumer.

Requirement: Compute the scalar product of two vectors.

Create two threads. The first thread (producer) will compute the products of pairs of elements - one from each vector - and will feed the second thread. The second thread (consumer) will sum up the products computed by the first one. The two threads will behind synchronized with a condition variable and a mutex. The consumer will be cleared to use each product as soon as it is computed by the producer thread.

Radu-Lucian LUPŞA
2020-10-11