Real-time Specification for Java (RTSJ), Page 2
Requirement Group for Real-Time Java
In 1998 a group of experts in real-time computer control was formed and coordinated by the National Institute of Standards and Technology (NIST) to draft requirements for real-time Java. The members were representatives from 50 different companies, government institutes and researchers from academic institutions. The main aim of the group was to develop a cross-disciplinary specification for real-time functionality that is expected to be needed by real-time applications written in Java programming language and being executed on various platforms. The group workshops at NIST produced nine core requirements for a Real-Time Java specification, together with number of derived sub-core requirements. This is the basis of the Real-Time Specification for Java (RTSJ). The weaknesses of the Java language specification for writing real-time applications are addressed in the core requirements.
The Real-Time Java Expert Group (RTJEG), where the specification leader from IBM produced a set of guiding principles for the design of RTSJ (Real-Time Specification for Java):
- RTSJ should not include any requirement that limits its implementation to any particular Java platform, version or environment (Embedded Java, Personal Java or Micro Java).
- Any modifications shall not, in any circumstances, prevent the execution of properly written non real-time software designed for any other JVM implementation.
- Even though the difficulty in specifying platform-independent real-time parameters is recognized, the W.O.R.A (Write Once Run All) principles must be pursued to the greatest possible extent.
- The specification should also include the current practice features of real-time systems while allowing the addition of advanced ones in the future.
- The most important feature to be pursued is predictability even at the cost of some general purpose performance.
- Any modifications must not include any extension to the language that lead to a requirement of compiler changes and hence increasing the likelihood of frequent releases.
Java Specification Request for Real-Time
There is a Java Specification Request (JSR-1) for Real-Time in the Java Community Process (JCP). The package name of this API for Real-Time Java is called "javax.realtime" and it has already had a final release in January of 2002. Real-Time Java (RTSJ) targets the EmbeddedJava, PersonalJava, JavaOS for Business, JavaOS for Consumer, and Enterprise Java (when implemented on an RTOS) platforms.
JSR-1 extends the Java Platform with an industry standard set of extensions that enables the construction of systems that exhibit real-time behaviour. It also targets both "hard real-time" and "soft real-time" systems. The "javax.realtime" API addressed the deterministic guarantees and/or control in the areas of thread scheduling, synchronization overhead, lock queuing order, class initialization, maximum interrupt response latency, and GC (garbage collector) characteristics.
Real-Time JVM guarantees deterministic run-time behaviour such as a real-time garbage collector. This JVM would only be implementable atop suitable target platforms, such as a real-time operating system (RTOS).
Design and Implementation
There are seven functional areas of focus for Real-Time Java: thread scheduling and dispatching, memory management, synchronization and resource sharing, asynchronous event handling, asynchronous transfer of control, thread terminations, and physical memory access.
- Thread scheduling and dispatching: A fixed-pre-emptive priority scheme with FIFO (First In, First Out) order inside priorities is defined to be the base scheduling policy. In addition, a set of features and an API are defined to host a variety of other scheduling mechanisms and policies.
- Memory Management: Both the advantages and drawbacks of garbage collected memory are recognized. Therefore, two simultaneous approaches are used to overcome the drawbacks: new memory regimes without garbage collection are introduced and standard interfaces to install real-time garbage collectors are also available.
- Synchronization and Resource Sharing : The priority ceiling emulation and priority inheritance protocols are established to bind the priority inversions in the monitors used to implement the keyword synchronized. Priority inheritance is provided by default, with optional priority ceiling.
- Asynchronous Event Handling : New extensions are specified to allow event-driven real-time applications to be implemented in RTSJ. Asynchronous event objects are added to represent asynchronous events that are expected to occur. These objects are then mapped to asynchronous event handlers to be executed whenever the event happens. These handlers are executed as real-time threads. It is easy to code an event-driven system structured so that each event is serviced by a thread created for that particular event and it makes the scheduling attributes of each event clear to the scheduler. The time between an event and the service of the event is an overhead on real-time responsiveness. Thread creation is slow. It is a resource allocation service, and real-time programmers avoid resource allocation when they are concerned about time.
- Asynchronous Transfer of Control : The semantics of the interrupt() method is expanded allowing it to occur anywhere in the code instead of only in certain blocking calls. An Asynchronously Interrupted Exception is then added to specify, through the throws clause in its signature, whether a method is able to receive this exception. Asynchronous transfer of control is a mechanism that lets a thread throw an exception into another thread.
- Thread Termination : A means is defined to request the orderly termination of a thread. It uses the asynchronous events mechanism to trigger the interrupt() method of the thread. The new semantics of this method would then enable correct thread termination.
- Physical Memory Access : A new memory region that can be mapped to a fixed physical location is defined. This enables threads inside Real-Time Java to communicate with physical devices directly
Dependent Specifications with implications in Control Industries
There is an extension to the RTSJ, which is the Java Specification Requests (JSR-50) for Distributed Real-Time. The Distributed Real-Time Specification for Java extends RMI in the Real-Time Specification for Java (RTSJ), to provide support for predictability of end-to-end timeliness of transnode activities. An Industrial Automation Extension draft (JSR-7) is a specification for a distributed real-time systems for the Java platform that will be utilized in factory automation environments as well as other automation application domains. JSR-7 will require the Real-Time Java (RTSJ) for application development.
The JSR-7 specification will target the basic Java Platform with potential extension to both the Embedded and Personal Java platforms. The specification will result in an industry standard for factory floor automation based on Java technologies as well as addressing the needs of an industrial conglomerate with dispersed global offices and manufacturing locations.
Real-Time Computer control software for large-scale operations is more complex to develop than database application development and the job of developing real-time systems in Java would be easier because there is already an API that is fully implemented. The reason for this complexity stems from the multi-disciplinary nature of real-time computer control. It covers Mechanical and Electrical Engineering, Electronics, Artificial Intelligence, Machine Learning, Mathematical Modelling, Optimizations and Applications, Physics Digital Control and Computer Science. We will see Java make a gigantic leap into all areas of automation and control from the small, as in a washing machine or dishwasher, or the medium, as in office assistant robot, to the huge and complex computer control systems used in Aircraft carrier, Shuttle Spacecraft, Electrical Power Stations, Telecommunication Networks, and so on.
The autonomous rover vehicle, known as Sojourner explored the Martian surface on a mission in 1997. Both A.M.E.S Research and J.P.L (Jet Propulsion Laboratory) are laboratories where NASA's rocket scientists design real-time computer control software for planetary autonomous vehicle such as the Sojourner. One of their current tools for developing intelligent real-time computer control is the most popular Java Expert Systems Shell (JESS) from Sandia National Laboratory. Dr. Ernest Friedman-Hill from Sandia and author of JESS has been giving lectures to the engineers and scientists at both AMES and JPL about intelligent application using JESS.
The weaknesses and deficiencies of the Java language for Real-Time Systems has been addressed in JSR-1 which is the API for Java Real-Time, package name "javax.realtime". The real-time JVM was a result of small modifications to the Java specification language. As you see that there are other Java Specification Requests (JSR) that will depend on "javax.realtime" , and the lists will grow over time. We will see Java dominate the softwares for the automation and real-time computer control industries over the coming years.
Downloads (RTSJ) Reference Implementation:
- Real-Time ADA and Java
- Software Design for Real-Time Systems by J.E. Cooling , pub: Chapman and Hall , London (1991)
- Real-Time Systems and their Programming Languages by A.Burns and A. Wellings, pub: Addison-Wesley, Workingham (1990)
- Real-Time System Design by S.T.Levi and A.K. Agrawala , pub: McGraw-Hill, New York (1990)
- Real-Time Software Techniques by W.S. Heath, pub: Van Nostrand, New York (1991)
- Journal of Systems and Control Engineering
- Artificial Intelligence in Real-Time Control
- IEEE Transaction on Software Engineering
- IEEE Transaction on Industrial Engineering
- Computer Control of Industrial Processes
About the author
Sione Palu has developed software for Publishing Systems, Imaging, and Web Applications. Currently, Palu develops (Swing-based) his own software application in Symbolic Algebra Systems with Visualization Mathematics for high-school level. Palu graduated from the University of Auckland, New Zealand, with a science degree in mathematics and computing. He has a personal interest in applying Java and mathematics in the fields of mathematical modelling and simulations, symbolic AI and soft-computing, wavelets, digital signal processing, and control systems.