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. Can we stop and .exe from anthoer .exe

Can we stop and .exe from anthoer .exe

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingcareer
15 Posts 7 Posters 1 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.
  • P Offline
    P Offline
    pandit84
    wrote on last edited by
    #1

    Hi , Is it possible to stop a running .exe and resume it later . After googling I came to know that every .exe is isolated from any other .exe. I am creating an application which will act like a 'BreakPoint setter' for second .exe . Is it possible to stop execution of exe and its threads from another .exe. Thanks

    N R 2 Replies Last reply
    0
    • P pandit84

      Hi , Is it possible to stop a running .exe and resume it later . After googling I came to know that every .exe is isolated from any other .exe. I am creating an application which will act like a 'BreakPoint setter' for second .exe . Is it possible to stop execution of exe and its threads from another .exe. Thanks

      N Offline
      N Offline
      Nitheesh George
      wrote on last edited by
      #2

      Hi, I am not sure this is possible, but If you do so, I think there will be a possibility for deadlock. Nitheesh George http://www.simpletools.co.in

      P 1 Reply Last reply
      0
      • N Nitheesh George

        Hi, I am not sure this is possible, but If you do so, I think there will be a possibility for deadlock. Nitheesh George http://www.simpletools.co.in

        P Offline
        P Offline
        pandit84
        wrote on last edited by
        #3

        Both the .exe file will be created under one parent application. One is a UI process and another is worker exe UI will try to add some break point and on the 'Click' event the another .exe will stop/resume its execution. So I cannt see any possiblity for deadlock. Correct me if I am not clear to explain

        R C C 3 Replies Last reply
        0
        • P pandit84

          Both the .exe file will be created under one parent application. One is a UI process and another is worker exe UI will try to add some break point and on the 'Click' event the another .exe will stop/resume its execution. So I cannt see any possiblity for deadlock. Correct me if I am not clear to explain

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          pandit84 wrote:

          One is a UI process and another is worker exe

          Why a worker executable? What's wrong with a worker thread? That way, you consume less resources AND can get the job to be done faster! Just use a worker thread, and one of the many thread synchronisation mechanisms like Critical section, mutex, etc. It could be as simple as a volatile variable, or could be as complex as a semaphore or having to use a pool of threads. Read up on thread synchronization, and use whichever synchronisation mechanism that suits your need.

          "Real men drive manual transmission" - Rajesh.

          1 Reply Last reply
          0
          • P pandit84

            Both the .exe file will be created under one parent application. One is a UI process and another is worker exe UI will try to add some break point and on the 'Click' event the another .exe will stop/resume its execution. So I cannt see any possiblity for deadlock. Correct me if I am not clear to explain

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #5

            I totally agree with Rajesh, and I would like to point you to this great article[^]. It will really help you understand how to work with threads.

            Cédric Moonen Software developer
            Charting control [v3.0] OpenGL game tutorial in C++

            1 Reply Last reply
            0
            • P pandit84

              Both the .exe file will be created under one parent application. One is a UI process and another is worker exe UI will try to add some break point and on the 'Click' event the another .exe will stop/resume its execution. So I cannt see any possiblity for deadlock. Correct me if I am not clear to explain

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #6

              You need some form of Inter-Process Communication to do that, see, for instance, Interprocess Communications[^] at MSDN. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              P 1 Reply Last reply
              0
              • C CPallini

                You need some form of Inter-Process Communication to do that, see, for instance, Interprocess Communications[^] at MSDN. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                P Offline
                P Offline
                pandit84
                wrote on last edited by
                #7

                The another .exe which is my worker exe will be running on a third party RTOS . Using synchronization it is possible within Win32 and RTOS process. My requirement docs says to stop a RTOS process from UI with a button click and resume it again with same button click (like a toggle) . Things will get more complex if synchronization is used because I am having ~32 threads on RTOS running. ... Thanks a lot for your nice reply

                R 1 Reply Last reply
                0
                • P pandit84

                  The another .exe which is my worker exe will be running on a third party RTOS . Using synchronization it is possible within Win32 and RTOS process. My requirement docs says to stop a RTOS process from UI with a button click and resume it again with same button click (like a toggle) . Things will get more complex if synchronization is used because I am having ~32 threads on RTOS running. ... Thanks a lot for your nice reply

                  R Offline
                  R Offline
                  Rajesh R Subramanian
                  wrote on last edited by
                  #8

                  pandit84 wrote:

                  The another .exe which is my worker exe will be running on a third party RTOS . Using synchronization it is possible within Win32 and RTOS process. My requirement docs says to stop a RTOS process from UI with a button click and resume it again with same button click (like a toggle) . Things will get more complex if synchronization is used because I am having ~32 threads on RTOS running

                  What RTOS?! And 32 Threads running on an embedded OS? :~ You did not give enough information in your first post. See How to ask a question[^], and edit your question to include all relevant information for someone to give you an appropriate response that may be of help.

                  "Real men drive manual transmission" - Rajesh.

                  P 1 Reply Last reply
                  0
                  • R Rajesh R Subramanian

                    pandit84 wrote:

                    The another .exe which is my worker exe will be running on a third party RTOS . Using synchronization it is possible within Win32 and RTOS process. My requirement docs says to stop a RTOS process from UI with a button click and resume it again with same button click (like a toggle) . Things will get more complex if synchronization is used because I am having ~32 threads on RTOS running

                    What RTOS?! And 32 Threads running on an embedded OS? :~ You did not give enough information in your first post. See How to ask a question[^], and edit your question to include all relevant information for someone to give you an appropriate response that may be of help.

                    "Real men drive manual transmission" - Rajesh.

                    P Offline
                    P Offline
                    pandit84
                    wrote on last edited by
                    #9

                    I appologies. I thought it like a normal programming scenerio. My application is actually a industrial software UI application with host 32 threads for a motion controller like a industrial robotics arms.

                    R 1 Reply Last reply
                    0
                    • P pandit84

                      I appologies. I thought it like a normal programming scenerio. My application is actually a industrial software UI application with host 32 threads for a motion controller like a industrial robotics arms.

                      R Offline
                      R Offline
                      Rajesh R Subramanian
                      wrote on last edited by
                      #10

                      So, give the following information:

                      1. Which operating system does your code run on? [Note: This particular board deals primarily with Windows, and may be flavours of UNIX. Other platforms can be supported as long as you're not doing anything propreitary to the OS, because people just may not know about it].
                      2. Are all the 32 threads are running in the context of the same process? If so, just use a thread synchronisation mechanism.
                      3. And what is this "other exe" you're talking about?

                      Please read the points mentioned in the link I gave you in my earlier reply, and include ALL relevant information if you want someone to help you.

                      "Real men drive manual transmission" - Rajesh.

                      P 1 Reply Last reply
                      0
                      • R Rajesh R Subramanian

                        So, give the following information:

                        1. Which operating system does your code run on? [Note: This particular board deals primarily with Windows, and may be flavours of UNIX. Other platforms can be supported as long as you're not doing anything propreitary to the OS, because people just may not know about it].
                        2. Are all the 32 threads are running in the context of the same process? If so, just use a thread synchronisation mechanism.
                        3. And what is this "other exe" you're talking about?

                        Please read the points mentioned in the link I gave you in my earlier reply, and include ALL relevant information if you want someone to help you.

                        "Real men drive manual transmission" - Rajesh.

                        P Offline
                        P Offline
                        pandit84
                        wrote on last edited by
                        #11

                        1. User interface is a Win32 process which communicates with worker layer (running on RTX - RTOS) , using shared memory. UI will be running on windows OS and Worker Layer exe will be running on Interval Zero RTX (Ver 2011). Worker on RTX RTOS will further communicating with hardware ( Industrial firmware components ) to control 32 motion controller devices. > 32 Threads are in same context i.e. on worker layer side. >"Other Exe" is nothing but RTX executable i.e worker exe. Again I would like to say a big "THANKS"

                        S C 2 Replies Last reply
                        0
                        • P pandit84

                          1. User interface is a Win32 process which communicates with worker layer (running on RTX - RTOS) , using shared memory. UI will be running on windows OS and Worker Layer exe will be running on Interval Zero RTX (Ver 2011). Worker on RTX RTOS will further communicating with hardware ( Industrial firmware components ) to control 32 motion controller devices. > 32 Threads are in same context i.e. on worker layer side. >"Other Exe" is nothing but RTX executable i.e worker exe. Again I would like to say a big "THANKS"

                          S Offline
                          S Offline
                          Stefan_Lang
                          wrote on last edited by
                          #12

                          What I would do is create a program 'work_cmd.exe' for your target platform that only handles the communication with your Win32 UI and nothing else. Your current worker.exe then should be demoted to a thread, and will be spawned from 'work_cmd.exe'. It will still be responsible for spawning the 32 sub-threads, but it needs explicit functions for the purpose of suspending or resuming those threads. Your 'work_cmd.exe' can then just tell your worker thread to suspend it's dependend threads, and, upon completion, suspend the worker thread itself. To resume, it resumes your worker thread, and then tells it to resume its 'sub-threads'. Note that my suggestion takes two commands to suspend or resume your threads, as 'work_cmd.exe' doesn't know about the additional threads and delegates their management to your worker thread. This assumes that the additional threads will not automatically be suspended with their parent. Maybe it's possible to spawn them in a way that forces them to be suspended whenever their parent is, but that might depend on your RTOS. (I'm not familiar with RTX) Note, also, that 'work_cmd.exe' will have to keep running and listening for UI commands.

                          1 Reply Last reply
                          0
                          • P pandit84

                            1. User interface is a Win32 process which communicates with worker layer (running on RTX - RTOS) , using shared memory. UI will be running on windows OS and Worker Layer exe will be running on Interval Zero RTX (Ver 2011). Worker on RTX RTOS will further communicating with hardware ( Industrial firmware components ) to control 32 motion controller devices. > 32 Threads are in same context i.e. on worker layer side. >"Other Exe" is nothing but RTX executable i.e worker exe. Again I would like to say a big "THANKS"

                            C Offline
                            C Offline
                            CPallini
                            wrote on last edited by
                            #13

                            So the unique possibility for your GUI to pause/resume the worker thread is by setting a value into the shared memory (and the worker application must poll this value constantly.

                            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                            [My articles]

                            1 Reply Last reply
                            0
                            • P pandit84

                              Hi , Is it possible to stop a running .exe and resume it later . After googling I came to know that every .exe is isolated from any other .exe. I am creating an application which will act like a 'BreakPoint setter' for second .exe . Is it possible to stop execution of exe and its threads from another .exe. Thanks

                              R Offline
                              R Offline
                              Rolf Kristensen
                              wrote on last edited by
                              #14

                              If the other application is running as a Windows service, then the "monitor" application can send a SCM pause command to the Windows service.

                              P 1 Reply Last reply
                              0
                              • R Rolf Kristensen

                                If the other application is running as a Windows service, then the "monitor" application can send a SCM pause command to the Windows service.

                                P Offline
                                P Offline
                                pandit84
                                wrote on last edited by
                                #15

                                Thanks alot to all . I will try to implement all suggestions.

                                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