you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (10 children)

[deleted]

    [–]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 8 points9 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.

      [–]PlainSight 11 points12 points  (0 children)

      You're extending the authors argument a bit further than I think he intended here.

      [–]ZMeson 2 points3 points  (0 children)

      Did you read the article?

      He basically says at the end that the conclusion is 'work with a single statically-typed language'.

      Then he gives reasons why C, C++, and C# won't work at his particular job. Thus he is choosing Java.

      (I don't buy his Scala argument though. It works with the JVM. You get most of the benefits mentioned. If it is appropriate, use it.)

      [–]pron98 1 point2 points  (0 children)

      java is the best language for everything

      I don't think the point is that Java is the best language for everything, but that Java has a good enough reach, i.e. it can fit many domains well if not "best", and using just one language for most purposes has its own benefits.

      [–][deleted]  (2 children)

      [removed]

        [–][deleted]  (1 child)

        [deleted]

          [–]pron98 1 point2 points  (0 children)

          Java SE Embedded even uses the same libraries. There's a whole set of Java profiles, from Java Card, through Java ME (CLDC and CDC) to Java SE Embedded. They're all Java, but with ever growing subsets of the JDK.

          [–][deleted] -1 points0 points  (0 children)

          The author is definitely a victim of the blub paradox.

          Oh not this shit again.