Question: URGENT:******* Write a C program that creates 5 pthreads. Each pthread executes a function that involves iterating through a loop 50 times. In each iteration
URGENT:*******
Write a C program that creates 5 pthreads. Each pthread executes a function that involves iterating through a loop 50 times. In each iteration of the loop, a thread increments an int from 0 to 0.9*MAX_INT and then prints the iteration number. Make sure that each of the 5 threads finish the ith iteration of the loop before they can start the (i+1)th iteration (i.e. all threads synchronize/rendezvous towards the end of each iteration). Use a two-phase barrier implemented using POSIX semaphores to enforce the synchronization constraint. (30 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
