Undergraduate research on real-time control, using a model railway system at the University of Northern Iowa, is described in this paper. In lieu of the typical Ada implementation for such an embedded system, Java was used, with a scaled-down runtime known as SimpleRTJ, supporting Java Development Kit (JDK) 1.1.
Two main benefits of using Java were identified: Java supports direct execution of the machine code (as opposed to interpretation of the bytecode) when a native method is called, and Java has direct support for concurrency, although this is a weakness when using native methods.
The drawbacks of using Java were also identified in several areas. First, as opposed to Ada, Java does not support declaring entry conditions on synchronized methods, which makes producing entry barriers more complicated, by requiring the careful arrangement of algorithms coordinating the behaviors of the low-level Java thread methods wait, notify, and notifyall. Moreover, implementing multiple entry barriers based on these thread methods generally requires more threads to be awakened when an entry condition becomes true than are actually waiting on the condition. This situation imposes extra processing overhead due to context switching, especially when the system must manage a large number of threads. Second, Java does not support thread scheduling based on task priorities and does not address priority inversion, where resource utilization causes a lower priority thread to block a higher priority one. Third, for life-critical embedded systems where dynamic memory management is prohibited, Java is disqualified. Fourth, Java’s bit-shifting operations do not support conveniently mapping the components of a record (class) onto the bits of a byte or word that would be used to internally represent the record. Fifth, a particular Java runtime (such as SimpleRTJ) may not provide checks on necessary initializations to ensure that unintended results are not produced when circular package dependencies are present.
The paper certainly provides a valuable reference on how Java performs for implementing real-time systems. However, it would be more productive to refine the languages that are more typically used for real-time programming (such as C and Ada) in the first place, rather than making Java (fundamentally designed for different purposes) work better in real-time programming environments, which is the goal of some real-time Java working groups.