The question I have is regarding barriers, in this example if there were only two processes, then while process one signaled the other would wait, and once the first has left the critical section, then the second process would run while the first would wait.
If my understanding of this is correct then we can proceed, I'm trying to understand if there were three processes and one would only leave when the other two processes are waiting at the barrier so that is what i am trying to do with this example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
semaphore b1(0), b2(0), b3(0);
process1() {
/*code before barrier*/
signal(b1);
wait(b2,b3);
/*code after barrier*/
process2(){
/*code before barrier*/
signal(b2, b3);
wait(b1);
/*code after barrier*/
process3(){
/*code before barrier*/
signal();
wait();
/code after barrier/