Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

coding_assignment_2 COMSC 260 Applied Operating Systems Spring 2021 Coding Assignment #2, Due: 11:59 PM on Sunday, April 11, 2021 Grading: 7% of the course’s final grade Submission: submit to Bridges...

1 answer below »
coding_assignment_2



COMSC 260 Applied Operating Systems
Spring 2021
Coding Assignment #2,
Due: 11:59 PM on Sunday, April 11, 2021
Grading: 7% of the course’s final grade
Submission: submit to Bridges a zip file or a tgz file that comprises your e
or and
warning free source code and three sample outputs.


A group of workers (n threads) is working on a project together and a task (sleep x
seconds) is assigned to each worker. All workers are working independently and may
finish their tasks in an a
itrary order. When a worker is done with its task, it must wait
for other workers to finish their tasks. When the last worker finishes its task, all workers
are released and can start a new project (program exists).
Design and implement a synchronization program for the group of workers using the
mutex and semaphore APIs defined in the POSIX thread (pthread) li
ary.
Answered Same Day Apr 08, 2021 COMSC 260

Solution

Vibhav answered on Apr 09 2021
176 Votes
ThreadSynchronization/1.JPG
ThreadSynchronization/main.c
#include#include#includeint finishCounter = 0;
pthread_mutex_t counterLock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t exitCond = PTHREAD_COND_INITIALIZER;
void * worker(void *arg){
    printf("%ld has started working.\n",...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here