Track Processes vs Timer Verify RRS feed

  • Question

  • Okay, so I have two applications that uses a WCF service to communicate between each other.  One is a dll loaded into a third-party app and the other is a simple exe.  The requirements are that the simple exe has to know about the dll and vice versa.  I've got all this to work just fine even when closing the third-party exe, but if the third-party exe crashes, the dll is unable to communicate the event so that the simple exe is aware. 

    Therefore the point is I have to also track the third-party exe processes in the simple exe so that it can refresh and maintain state.  I've tried looking at various options and I can really boil this down to two approaches:

    1. In the Simple exe, track the System.Diagnostic.Process for each third-party exe using the service and register to it's Process.Exited event.  My guess is that this is more memory intensive and could affect performance since it should involve interaction with the OS to communicate closing of the service.  However this would entail the fastest response.
    2. In the Simple exe, use some form of background timer to periodically check the processes.  Again, my guess is that this would be less memory intensive, but would be slower since events could occur at the beginning of the wait period and not at the end of it causing a delayed response.

    The Simple exe knows the third-party exe is communicating with it via the WCF Service and I don't want to add anything else to the service which leaves me to these two options.  Unfortunately, neither seem to scream out efficiency, so what's the best approach here?


    Thursday, July 25, 2013 9:17 PM

All replies

  • For me, the heart-beat approach sounds the more practical, but I don't know what your requirements are regarding how quickly you need to be informed about the crash.

    Sunday, July 28, 2013 7:53 AM
  • Honestly, as close to real-time as possible would be best, but if a sacrifice is reasonable, I'm okay with it.  I've heard of the "heart-beat" approach.  What's a typical time period between beats?  And what's the smallest time period typical without sacrificing performance?


    Monday, July 29, 2013 12:01 PM
  • Depends on the stress the system is under. You maybe able to get a handle to the process and keep hold of that. You can then heart-beat by asking simple questions of the handle rather than searching for the process each time.

    Monday, July 29, 2013 1:28 PM