You can easily manage all child processes you start from your application, if you pay attention that the method
System.Diagnostic.Process.Start
returns an instance of
System.Diagnostic.Process
:
[
^].
In your code, you just ignore the return value, but you can collect those references to child processes in some container (such as
System.Collections.Generic.List<System.Diagnostic.Process>
), and them count them, wait for process termination in some other thread, kill the process or… do whatever else you may want.
I would only note that not only having so many processes would be really bad (I agree with your), but the whole idea of the program architecture based on starting of several starting processes is very, very questionable. The processes are relatively heavy wait, and, importantly, the separate processes are well isolated, so you have very limited ways of controlling processes form another process. Threads of a single process are much more flexible, accessible and light weight (in separate Application Domains or in the same one, it depends on the purpose).
That said: perhaps, if you told us the ultimate purpose of all your processes, you could get much better advice.
—SA