Question: Barrier synchronization problem: A parallel program contains N processes, which execute in synchronized phases (steps). After completing execution of phase i, each process waits for

Barrier synchronization problem: A parallel program contains N processes, which execute in synchronized phases (steps). After completing execution of phase i, each process waits for all the other processes to complete their i'th phase. For this purpose, each process executes a function called Barrier Synch(i), after executing the code for phase i. When the last process reaches the barrier and executes this synchronization function, it unblocks all the other (N-1) waiting processes to resume their execution for phase (i+1). This form of execution of steps and barrier synchronization repeats at each phase.

Write synchronization code using semaphores to implement the barrier synchronization problem described above. You should pay attention to race conditions where a process resumed from i'th phase barrier may quickly finish its execution of the next phase and start executing the barrier synchronization code for the (i+1) 'th phase while some other processes are still executing the barrier synchronization code for phase iPhase i Phase Process 1 BarrierSynch(i) BarrierSynch (i+1) Process N 

Phase i Phase Process 1 BarrierSynch(i) BarrierSynch (i+1) Process N

Step by Step Solution

3.43 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer Barrier synchronization is used to synchronize two or more processes so that all processes mu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Economics Questions!