Reputation: 57
I need to run 4 Processes exactly at the same time, how to do it?
Process.Start();
Process.Start();
Process.Start();
Process.Start();
When i do it like this there are a milliseconds differences between all processes. I can't have any differences.
Thanks for all answers.
Upvotes: 3
Views: 336
Reputation: 693
This is not possible on the managed stack. You do not have that tight of control over process execution. If you need more strict control you will need to use native code, C, C++, Assembly. In addition, you will need strict control over process execution which means you need to be using a RTOS (Real Time Operating System). In no way can Windows (a non real time in-deterministic execution engine) accomplish this in any scenario.
You can pseudo control it by building your own execution engine and then managing the threads but this will only get you pseudo control. In the end, it will still be milliseconds apart in many cases.
RTOS is only truly RTOS because the architects run analysis on all tasks that are to be run and can determine if they can execute by their deadline. This has nothing to do with starting them at the same time. For that you will actually have to build firmware for the chip build APIs that you can signal a process start and all of your processors will start the loaded process. In other words, if you want to do this you have to get down to the metal and build APIs that allow each processor to start synchronously with the other.
It may be possible using something like CUDA (GPU computing) which is C++ and requires nVidia. OpenGL is the open stack and can likely do it on any GPU, but the fact is C# is a managed stack so you will have to go down to native code and also have access to hardware API that allows process syncing.
Upvotes: 6