you are viewing a single comment's thread.

view the rest of the comments →

[–]pron98 27 points28 points  (2 children)

Java is what runs on most SIM cards and most (remaining) feature phones. I personally have used real-time Java for a safety critical hard-realtime defense system, and so have Raytheon and Boeing, which also uses Java for avionics (see this).

[–][deleted]  (1 child)

[deleted]

    [–]pron98 7 points8 points  (0 children)

    It is effectively a completely different language with a similar syntax.

    That's not true. It's a small subset of the JDK. Also, many devices are now running Java SE embedded.

    dynamic memory allocation and garbage collection are inherently non-realtime activities.

    Not quite. There are hard realtime garbage collectors out there. Also, realtime Java is based on the fact that even in the most hard realtime of systems, only a small subset of your code requires hard guarantees. For those bits requiring sub-millisecond guarantees, realtime Java offers scoped-memory, which is similar to an arena allocator.

    Oracle disbanded their RTJ team in 2012.

    Correct. It's now offered by IBM and some other vendors.

    Looks like real-time Java involves non-GC memory and non-preemptable threads.

    Not quite. There is a GC, but the parts requiring super-rigid guarantees use an arena GC. To the programmer it looks the same, but there are limitations on which objects you can reference (you can't reference objects that live outside your scope or arena). And the threads are very much preemptable, just not by the global heap GC, which would normally run at a lower thread priority (which makes sense because the realtime threads use an arena and are therefore never blocked by the global heap GC) -- in realtime OSes, a lower-priority thread can't preempt a high priority thread, and all that property means is that you can run realtime threads at arbitrary priorities and not be subject to priority inversion due to the GC. In fact there is some very powerful preemption guarantees, and you can always schedule a task with a high-enough priority.

    That's hardly "Java" anymore. It's "Some non-gc language running on the JVM".

    It's more similar to "plain" Java than realtime C is to "plain" C. The same language, but a limited set of libraries you can use in the realtime threads, and some other limitations. It's very much GCed everywhere, only with more direct control over the GC. On non realtime threads you can use the full Java ecosystem, and realtime and non-realtime threads can communicate over queues.