Synchronization process

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:

it is assumed that the five processes are available according to the graph (cycle is formed of five process).
each process has two neighboring processes. they would apply ordonnencement (synchronization) of the five processes. if the process Pi execute its function Gi (), neither of these two neighboring process can execute its function. example if the P2 execute G2() function then P1 and P3 should be prevent to execute their functions G1 () and G3 () respectively.
using tubes communications (pipe) write the necessary code this synchronization
2. Relevant commands, code, scripts, algorithms:

  1. The attempts at a solution (include all code and scripts):
 
 /*I used 5 pipes .*/
 int t125[2],t123[2],t234[2],t345[2],t145[2];int x;
 if(i==1)
 {read(t123[0],&x,sizeof(int));
 read(t145[0],&x,sizeof(int));
 G1();
 write(t125[1],&x,sizeof(int));
 write(t125[1],&x,sizeof(int));
 }
 if(i==2)
 {read(t125[0],&x,sizeof(int));
 read(234[0],&x,sizeof(int));
 G2();
 write(t123[1],&x,sizeof(int));
 write(t123[1],&x,sizeof(int));
 }
 if(i==3)
 {read(t123[0],&x,sizeof(int));
 read(t345[0],&x,sizeof(int));
 G3();
 write(t234[1],&x,sizeof(int));
 write(t234[1],&x,sizeof(int));
 }
 if(i==4)
 {read(t234[0],&x,sizeof(int));
 read(t145[0],&x,sizeof(int));
 G4();
 write(t345[1],&x,sizeof(int));
 write(t345[1],&x,sizeof(int));
 }
 if(i==5)
 {read(t125[0],&x,sizeof(int));
 read(t345[0],&x,sizeof(int));
 G5();
 write(t145[1],&x,sizeof(int));
 write(t145[1],&x,sizeof(int));
 }
 
  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    Lebanese university,beirut,lebanon,sami,Operating system II.

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

You have shown us a picture showing 5 processes and have indicated that you are supposed to use pipes to communicate between those processes to negotiate which processes are allowed to run "critical" code.

You have shown us a short snippet of code that reads from and writes to what I presume are pipes, but there is no indication of how that I/O is being used for synchronization. From the code you have shown us, we don't know what is working, what isn't working, nor what help you're hoping to receive by posting here.

Please explain how the code you have shown us is supposed to fulfill your assignment and tell us what help you need.