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?
April 15th, 2009, 02:27 AM
Re: concurrent operations
I guess you need only to google a little bit, you can find this: http://www.unix.com/high-level-progr...processes.html
Originally Posted by brad sue
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.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!