How to sync processes using semaphore
问题 let's say I have 3 processes including a parent process I have to execute I program in sequence of P3,P1,P2. Guys please help me how I can start the computation from process P3. I need the out as {0,1,2,3,4,5,.. max} For the reference my code snapshot is :- #define SEM_NAME "//test.mutex" //#define SEM_NAME2 "//test2.mutex" int main(int argc, char const *argv[]) { int max = 0, i =0; sem_t *sem; sem_t *sem2; pid_t pid, pid2; sem = sem_open(SEM_NAME, O_CREAT, O_RDWR, 1); sem_unlink(SEM_NAME);