2

I'm going to create an application that will act as some sort of task manager. For stability reasons I will not use threads but processes instead. I have to deal with several third party libraries and/of COM servers that are not always that stable and can produce severe crashes sometimes. This may (of course) not affect the task manager

Problem with using processes is how to communicate with them? The process must f.e. give a status back of what it's doing every x seconds.

I was thinking of using TCP over a separate port per process, but is this the best way of doing this?

5 Answers5

6

Named pipes would probably be more efficient. Take a look at WCF:

Expose a WCF Service through a Named Pipes binding

Community
  • 1
  • 1
Ohad Schneider
  • 36,600
  • 15
  • 168
  • 198
2

You could use WCF (with the NetNamedPipeBinding binding).

And maybe consider AppDomains to run your processes in.

H H
  • 263,252
  • 30
  • 330
  • 514
  • I agree, but in my solution I cannot use services. It need to be processes. –  Jan 06 '11 at 19:24
  • @marc, appdomains != services – H H Jan 06 '11 at 19:31
  • Ok, then I'll take a look at that also in more detail. At first pipes looks the easiest approach, but again: don't know that for sure yet. –  Jan 06 '11 at 19:44
1

Using pipes would be a good option. Look at the System.IO.Pipes namespace.

Taylor Leese
  • 51,004
  • 28
  • 112
  • 141
  • At first this looks like what I need. Simple without any additional setup needed. –  Jan 06 '11 at 19:21
0

I think you should look at Instrumentation:

http://msdn.microsoft.com/en-us/magazine/cc300488.aspx

Any other approach such as talking on ports or WCF adds layers which can make deducing the root cause of problems harder; it also pails in comparison performance wise to Instrumentation. WMI is built around high performance monitoring. In addition, operationally this is the best approach as it plays into Admin tools for monitoring the health of processes.

Keith Adler
  • 20,880
  • 28
  • 119
  • 189
0

I would go with WCF and named pipes as well, but if you´re up for it you could use signaling and shared memory (memory mapped files). It´s way faster, but it might not be worth the code complexity.

Take a look at this blog post for some sample code.

Mikael Svenson
  • 39,181
  • 7
  • 73
  • 79
  • The communication needed is quite limited, so this might be not the most ideal solution for this task. –  Jan 06 '11 at 19:25