how can i control two processes to run alternately in separate terminal windows. for example i run the code for each on separate terminal windows at 11:59 and both of them wait for the time to be 12:00. at this moment process one starts execution and process two waits for say 10 seconds. then they switch, process two executes and process one waits. in this way they take turns until the process is complete.
A:
Pipes, or named pipes? Each process waits in a read for the other to write a byte to it.
Also, possibly use signal files. Process B sleeps for 100 ms, checks for file Foo, and repeats. When process A creates the file, process B deletes it, and proceeds. Then the reverse happens with file Bar.
Mike Dunlavey
2010-03-15 20:03:27
i am using ubuntu 9.04. i have never done this before so if you could tell me where to start, it would be great. the complete idea is that the two terminal windows run on a single PC with another computer that acts as receiver connected via specialized hardware (ever heard of the usrp). the receiver PC identifies data from the individual sources and puts them in individual files. the two terminal processes should take turns to transmit.
omrihsan
2010-03-16 05:47:38
@omrihsan: I'm not familiar with ubuntu, but since both terminal apps are in one machine and can see a common file system, signalling files should work as I outlined.
Mike Dunlavey
2010-03-16 11:40:17
A:
You can use System V semaphores or Windows named mutexes (via CreateMutex). You could even resort to file locks. Which OS are you on and what are your restrictions?
disown
2010-03-15 20:10:10
i am using ubuntu 9.04.the complete idea is that the two terminal windows run on a single PC with another computer that acts as receiver connected via specialized hardware (ever heard of the usrp). the receiver PC identifies data from the individual sources and puts them in individual files. the two terminal processes should take turns to transmit.
omrihsan
2010-03-16 05:45:52