3 win32 applications running parallel
-
Hello, I have a programming problem which require a great degree of parallel programming, but i not too sure about using multithreading, thus i made use of an alternate method which seem to work so far... I compile 3 different win32 applications A,B and C. Both A and B will output some values to 2 output files a and b using the fprintf method. C will access these 2 files a and b, and output a file c, which would then be read by B again to conduct some operations. I would like to ask: 1.are there any foreseeable problems which i do not know of for using this method ? 2.Would the 3 applications be running almost in parallel this method, or will there be a delay between each of them ? Is the delay significant if any ? 3.Would the multithreading method be better ? What are the advantages and disdvantages between the 2 ?
-
Hello, I have a programming problem which require a great degree of parallel programming, but i not too sure about using multithreading, thus i made use of an alternate method which seem to work so far... I compile 3 different win32 applications A,B and C. Both A and B will output some values to 2 output files a and b using the fprintf method. C will access these 2 files a and b, and output a file c, which would then be read by B again to conduct some operations. I would like to ask: 1.are there any foreseeable problems which i do not know of for using this method ? 2.Would the 3 applications be running almost in parallel this method, or will there be a delay between each of them ? Is the delay significant if any ? 3.Would the multithreading method be better ? What are the advantages and disdvantages between the 2 ?
bad design dude ! why are you not sure about using threads, they are much easier to manage then 3 full blown applications. How would an application know when to read a file? What happens if one of the crashes (it can happen :-D ) all in all the design doesn't give you a warm and fuzzy feeling :-D Stick with threads and pass data structures around don't use files, use Critical sections, Events and other such stuff to time the threads right, much better way IMHO.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
-
bad design dude ! why are you not sure about using threads, they are much easier to manage then 3 full blown applications. How would an application know when to read a file? What happens if one of the crashes (it can happen :-D ) all in all the design doesn't give you a warm and fuzzy feeling :-D Stick with threads and pass data structures around don't use files, use Critical sections, Events and other such stuff to time the threads right, much better way IMHO.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
For one i am not too sure about using threads...so far my experience with thread have been rather negative...i cant seem to find any good references around for multithreading. The application doesnt need to know exactly when to read the file since it is constantly being updated by the 3 applications. Also, i am quite confident that they wouldnt crash... hmm..but is will running 3 applications take up more resources as compared to threading a single one ?
-
For one i am not too sure about using threads...so far my experience with thread have been rather negative...i cant seem to find any good references around for multithreading. The application doesnt need to know exactly when to read the file since it is constantly being updated by the 3 applications. Also, i am quite confident that they wouldnt crash... hmm..but is will running 3 applications take up more resources as compared to threading a single one ?
BeakX wrote:
i am quite confident that they wouldnt crash...
3 application accessing the same file and updating its contents i wouldn't be so sure but its your program if you feel confident go ahead. but this was a great oppurtunity to learn multithreading cause if you do this for a living(or plan to) you would surely need to implement threads in future just my 2 cents :-D
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
-
For one i am not too sure about using threads...so far my experience with thread have been rather negative...i cant seem to find any good references around for multithreading. The application doesnt need to know exactly when to read the file since it is constantly being updated by the 3 applications. Also, i am quite confident that they wouldnt crash... hmm..but is will running 3 applications take up more resources as compared to threading a single one ?
Problems in multithreaded code only occur if both threads touch the same resource without synchronization - this applies equally to EXE's that share a resource, it's just that its harder to share such things a memory across processes. Assuming you're not using anything such as shared memory and given that you've divided the problem into 3 EXE's there's obviously not much in the way of shared resources - In this case you don't stand to lose much (if anything) by using three threads instead, but you gain efficiency as a thread is considerably more lightweight then a process. Steve