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
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
However, if you are new to concurrency, I'd suggest you to use the pipe, the second example (in the link), which I usually do. Fork is very useful, for the fact that it is very simple and easy to synchronize using pipe.
Bookmarks