1

I wonder is it possible to start process from another process with arguments (not string params). Probably it can be overcomed somehow.

I have process1 which do a lot of operations and it needs to send an object into another process to do some external calculations. Finally it should return results.

Let's say process1 created: NiceClass nc = new NiceClass(new List<string>{'a', 'b', 'c')) Now I want to process2 make a .Remove() for example and return to process1 {'a', 'b'}

In other words second process should behave like a normal method but completly external. Is it even possible? Pointers maybe(I have no idea how to use it anyway)

Thank you very much for an answer

Darshan Kunjadiya
  • 3,267
  • 1
  • 26
  • 31
Mateusz Gaweł
  • 671
  • 1
  • 6
  • 22
  • I hardly doubt that operating system security (memory) model will allow you to do such kind of things. You should better choose some technology to communicate between processes e.g. WCF - look at this question http://stackoverflow.com/questions/84855/what-is-the-best-choice-for-net-inter-process-communication. – mipe34 Aug 02 '13 at 12:15
  • You are talking about IPC in c# see http://stackoverflow.com/questions/56121/ipc-mechanisms-in-c-sharp-usage-and-best-practices for some information. Passing an object between two processes is going to be tricky and I think also very dangerous. Normally IPC is limited to instructing the other process what to do, for example perform calculations using values X,Y,Z. Another possibility is to dynamically generate an executable and run this in a separate process, again there are issues with this method. – TheKingDave Aug 02 '13 at 12:18

1 Answers1

1

Apart from the obvious (WCF), there is a ZeroMQ binding for C#/CLR which is pretty good:

http://www.zeromq.org/bindings:clr

Does message-oriented IPC, pub/sub and various other strategies with much less code and config than WCF.

It's also at least an order of magnitude faster than anything else and has less latency if you require low latency comms.

With respects to semaphores, locks, mutexes etc. If you share by communicating rather than communicate by sharing, you'll have a whole load less hassle than the traditional paradigm.

sourabh devpura
  • 535
  • 6
  • 23