Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. 3 win32 applications running parallel

3 win32 applications running parallel

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BeakX
    wrote on last edited by
    #1

    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 ?

    M 1 Reply Last reply
    0
    • B BeakX

      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 ?

      M Offline
      M Offline
      Monty2
      wrote on last edited by
      #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

      B 1 Reply Last reply
      0
      • M Monty2

        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

        B Offline
        B Offline
        BeakX
        wrote on last edited by
        #3

        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 ?

        M S 2 Replies Last reply
        0
        • B BeakX

          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 ?

          M Offline
          M Offline
          Monty2
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • B BeakX

            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 ?

            S Offline
            S Offline
            Stephen Hewitt
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups