P threads

Job ID: 33148612

Budget: $30 – $250 USD

Translate Figure 5.14 into a Pthreads implementation (sample code available at: https://linux.die.net/man/3/pthread_create). Use semaphores as indicated in the figure (see https://linux.die.net/man/7/sem_overview). Rather than a single consumer, implement five. Let produce simply supply the next long long value: originally initialized to zero. Let the main terminate all threads after five minute. Create a chart which depicts how times each consumer consume a value from the buffer.

Test in your Ubuntu environment.

Submit your code and report (with chart) here.

Bonus points (10): Create a chart (also included in your report) which shows which values were consumed by which consumer.
Related categories: C Programming Python Linux Shell Script C++ Programming