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 »
None


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 error 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 arbitrary 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) library.
Answered Same DayApr 08, 2021COMSC 260

Answer To: coding_assignment_2 COMSC 260 Applied Operating Systems Spring 2021 Coding Assignment #2, Due: 11:59...

Vibhav answered on Apr 09 2021
174 Votes
ThreadSynchronization/1.JPG
ThreadSynchronization/main.c
#include
#include
#
include
int 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