[Mono-list] mono and real-time programming

Paolo Molaro lupus@ximian.com
Mon, 17 Mar 2003 12:05:58 +0100

On 03/15/03 Parrish M Myers wrote:
> I am currently taking a real-time programming class this semester.  For
> the class we are required to do a project.  Of which, I want to do it
> on real-time aspects/considerations of C#.
> What little information I have found, about the subject, indicate that
> C# is no good for hard real-time applications, but not much more.  Does
> anyone know some sites for information on the subject? Maybe even how
> this relates to mono...  Anything would be greatly appreciated.  I can
> certainly share any information I find out (if anyone is interested).

When garbage collection enters the picture, it's hard to keep up with
the requirements of hard realtime (assuming the operating system you're
using supports it) and other issues that are related to how the CLR
works (like compilation of methods on the fly).
You can reduce the compilation overhead by telling the runtime to
pre-compile methods (either programmatically or with a ngen-like utility).
The GC issue is harder to solve: you can set the env var GC_DONT_GC
before starting the app. This will disable garbage collection so you
need to ensure the application has a bounded use of memory or it can be
restarted at some safe point etc.
The other solution would be to start a separate thread that is not under
the control of the garbage collector and you need to either ensure all
the objects used in such a thread are referenced from some other thread
so they are kept alive or you don't run managed code in it.


lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better