The Java programming language encapsulated many of the research ideas on object-oriented programming developed in the 1980s and 1990s and was instrumental in making object-oriented development the normal approach used for the development of new application systems. However, the language was never designed for the development of real-time systems as it lacked features that allowed programmers control over the timing behaviour of programs.
Because of the popularity of Java as a development language, there has been a major effort to address the shortcomings of Java as a real-time development language and to introduce new features into the language to support real-time development. These led, over a number of years, to the development of a real-time specification for Java. This includes both changes to the language and to the Java Virtual Machine (JVM), the run-time system for Java.
The key features that have been included in real-time Java are:
- Precise memory management. A major problem with Java is that garbage collection is unpredictable and, if garbage collection kicks in during an operation, the response time may be affected. Real-time Java introduces the notion of immortal memory where objects are created but never destroyed and scoped memory where objects are destroyed when a process goes out of scope. Neither of these memory types are garbage collected.
- Direct memory access. Programs can access physical memory directly, thus allowing direct hardware interaction in embedded systems.
- Asynchonous communications. This includes asynchonous event handling where the response to events from outside the JVM can be scheduled and asynchronous transfer of control which allows threads to be safely interrupted.
- Precise timing specification. Time may be specified to the nanosecond level of precision.
- Real-time threads. These are processes that are not interrupted by garbage collection and which may be assigned up to 28 priority levels. A lower priority thread cannot block access to a resource that is needed by a higher-priority thread.