How to control and synchronize concurrent code execution

network_sat

Estimable
Jul 10, 2015
8
0
4,510
0
Hi.

Suppose I have two programs where some sections of the code of one program file depend on the some sections of other program. How can I make sure that the dependency is executed properly. I mean dependent section of one program does not execute faster than the section of other program which depends on the first program's section...

Thanks
 

kanewolf

Judicious
Moderator
You would have to use some type of synchronization. You would use semaphores, or spinlocks, or other constructs. Each program that has a section that is dependent on the other would attempt to establish some type of lock which would prevent the other program from executing code which could conflict. If the second program is doing something independent it would continue. When it gets to an area in code that could conflict the lock would prevent it from progressing until the first application released the lock. Then the second program would establish the lock to prevent the first program from interfering. There are lots of tutorials on thread synchronization. The concepts are the same although the implementation might be slightly different with two executables.
 
Thread starter Similar threads Forum Replies Date
H Apps General Discussion 1
J Apps General Discussion 1
L Apps General Discussion 4
Mrs Nadeem Apps General Discussion 1
K Apps General Discussion 1
M Apps General Discussion 1
P Apps General Discussion 8
H Apps General Discussion 2
M Apps General Discussion 5
R Apps General Discussion 1
R Apps General Discussion 5
A Apps General Discussion 1
H Apps General Discussion 3
G Apps General Discussion 5
A Apps General Discussion 4
henrytcasey Apps General Discussion 2
Mike Andronico Apps General Discussion 15
M Apps General Discussion 3
A Apps General Discussion 2
Z Apps General Discussion 1

ASK THE COMMUNITY