views:

189

answers:

4

I'm interested in getting comprehensive information about soft (hard too) real-time application in .Net 3.5/4 Winforms mainly (WPF perhaps). Google results for the thing are quite poor - some quides on parallelism only ... the question is how could I for example write a real-time patient-health monitoring client for some medical appliance? or broker application with real-time stock data? or navigation system for a train? or a house-automation software which is responsible for opening/closing doors? etc ... so this kind of realtime app is the target.

So far I haven't found any books on it except Concurrent Programming on Windows - which is basicly not about this , rather parallelism handling ...

Thanks in advance

+4  A: 

My personal feeling is that if your requirements are for real time software you shouldn't be using .net

.net uses a virtual machine that is not geared towards real time applications. For example, you cannot predict when the garbage collector is going to run, or how long it is going to take. If this happened at a critical moment, your real time software would no longer be real time.

[Edit: Sorry, I know that's not really answering your question, but I think this is probably the reason why you are having trouble finding information on it - because nobody does it. If you are writing real time software you should probably be looking at C or C++ instead. And depending how critical it is, a dedicated deterministic real time operating system. Or even specific languages designed with real time in mind]

Simon P Stevens
You cannot predict when the garbage collector will run, but you can stop it from running in critical areas.
Mark
@Mark: Cool. I didn't know that. Have you got an example?
Simon P Stevens
+1  A: 

I disagree with @Simon, you can build real-time systems with Windows and .NET. You may not be able to build very specific hard time systems, but with proper design and testing you can and I have.

There are many techniques to push hard time requirements on to software solutions or hardware such as motion/IO controllers. Windows/.NET makes much of the system easier to develop than RTOS development and the few time critical elements can be addressed. My approach is to address these time critical concerns first and test.

kenny
Perhaps with special hardware or software solutions that call outside the .net framework. But I can't see how you can do real time apps from entirely within .net. The CLR just isn't deterministic enough. How would you ever get guaranteed CLR loading times, assembly resolution, JIT compilation. Not to mention that the CLR optimises differently in different situations. I'm sure it's possible with external calls to do the critical stuff, but from 100% .net? [I'm not talking about simple 'live view' apps, I'm talking about "real time" where there is a specific time constraint on the requirements]
Simon P Stevens
This isn't a particular area of expertise of mine, so If you have done 100% .net real time apps, I'll take your word for it. It would be good to know.
Simon P Stevens
Simon, it's about design. When developing real-time systems, you try to avoid anything dynamic like loading assemblies, memory allocation, etc... At least avoid it in time critical code.
kenny
But isn't that the problem? In .net you can't avoid CLR managed memory allocation. I suppose what you are saying is just avoid it in critical areas which is fair enough I guess.
Simon P Stevens
+1  A: 

In my company we have developed an telphony IVR server in C# and C++/CLI. It handles millions of calls per year, runs 24/7, never crashes and is generally as robust as we could wish for. There is nothing fancy about it, it is just regular windows service and while speed, efficiency and response time has obviously been something we've aimed for, it doesn't do anything esoteric like trying to control GB etc.

There is however a big but. The drivers for the hardware controlled by our application is obviously not .Net. So at the very lowest level we are not concerned by unwanted GBC and so on, all the millisecond dependent stuff like forwarding of IP telephony packets or voice streaming is handled by the firmware on our telephony boards.

So to summarize the above: I would never even consider writing drivers or very very low latency code in .Net, but I would definitely write the controlling code/logic in .Net.

Unfortunately I cannot point you to any useful resources, since I've never encountered any either, but I hope this use case will help you make an informed decission on whether you should consider .Net for your real-time projects.

JJJ
+1  A: 

Parralelism and threading are some of the tools .NET provides to help you write real time applications, but the architecture of real time systems is language independent.

This MSDN article has some good links for parallel computing.

Perhaps the Smart Client Software Factory might be a good reference implimentation for you to start investigating.

Mark