brad sue
April 12th, 2009, 12:31 PM
Hi, first please pardon me if my post is in the wrong section.. correct me please.
I would like to understand how the to make 2 processes (in UNIX environment )work in parallel ( like cobegin)
and when they are done, a Unix semaphore signal is called so the a third process starts doing its operations.
say p1 (process 1) is doing a+b
say p2 (process 2) is doing d+c
when they have both finished, then p3 (process 3) starts doing its thing.
I was thinking using fork() since it creates a duplicate of the program. I am not sure it is sufficient to generate a cobegin action
Also how to use Unix semaphore to synchronize all those processes?
I want that each process has a semaphore associate with it.
Please can someone help me to clarify this issue like some kind of pseudo code?
Thank you
I would like to understand how the to make 2 processes (in UNIX environment )work in parallel ( like cobegin)
and when they are done, a Unix semaphore signal is called so the a third process starts doing its operations.
say p1 (process 1) is doing a+b
say p2 (process 2) is doing d+c
when they have both finished, then p3 (process 3) starts doing its thing.
I was thinking using fork() since it creates a duplicate of the program. I am not sure it is sufficient to generate a cobegin action
Also how to use Unix semaphore to synchronize all those processes?
I want that each process has a semaphore associate with it.
Please can someone help me to clarify this issue like some kind of pseudo code?
Thank you