I remember reading in Java's EULA that you acknoledge not to use it for certain things (real time applications). I did a bit of research on this matter and came to the conclusion that it is due to Java's garbage collector that makes Java slower and thus unfit / or not the best choice for real time app development. But now I have another question, C#, it also have garbage collector yet there are people on the internet that claim they write real time applications in this?

My question comes down to this: If I were to choose between Java and C# for real time applications (Exluding C++, which would be my first choise) which one (C# or Java) would give better performance / or can be used for real time applications?

Recommended Answers

All 3 Replies

First off, you aren't going to be writing hard real-time applications on Windows, or on any other operating system that uses virtual memory without specific support for unswappable pages. That's the first thing to understand: if there is a possibility of a delay in response time due to paging or swap time, real time performance is simply not possible. There are specialized operating systems around that are real-time, such as Qnx or eCos, but your typical desktop OS simply isn't suited for real-time work.

The other thing to understand is that most of the things you are probably thinking of as 'real time performance', such as music players or games, aren't, at least not in a technical sense. The term 'real time' refers not to speed, but rather to reliability and precision: a hard real-time operation is defined as one which guarantees that a given action will be taken between time t and time t', without failure - it is what you need when running an aircraft's control surfaces, for example, or the timing of actions on an assembly line. Soft real-time promises best effort response in the given time window; typical examples are the response time of a printer to a print command.

Bottom line: unless you are developing for a hardware manufacturer, you are unlikely to ever do any real-time programming.

As mentioned, you first need to be using an operating system who's kernal calls are guerenteed to work in real time.

Then there are a few problems with the JVM itself (garbage collection, JIT, threading) that don't guerentee real-timeness. You'll need to find a real-time replacement JVM, for example JamaicaVM-PE.

Then you also need to be very carefull about how you write your program in order to assure that it runs in real-time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.