This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
In olden days the most Real-Time software applications are developed using C and Ada. Due to the drawbacks present in such languages that is testing, maintaining and extend to the other platforms is hard. Due to the significant features of Java such as portability, robustness and simplicity etc. are forced the real-time system developers to use the significant advantages of the Java. However due to the draw backs of the core Java, mainly calculating the worst case execution time of Java code is very difficult because of automatic garbage collection, loading classes dynamically and method invocation. To overcome these problems the API (Application programming interface) which provides the functionality of the real-time application development enhance the Java to suit to the real-time applications development. This RTSJ's API provides the incremental garbage collector and memory management. These issues are not addressed in the basic Java. This is facilitating enormous improvement and improves the suitability of Java for machine critical applications.
Some of the basic fundamental of the Real-Time Specification for Java (RTSJ) are discussed in the previous chapters. RTSJ is basically consisting of set of classes which supports the programming for Real-time applications. The below figure is shows the basic architecture of the RTSJ.
Fig.4.1.1: Basic architecture of the RTSJ.
4.2 Features of RTSJ
Java RTS is one of the first Real time implementation in commercial real time application development and it is addressed the problems associated with the other real time programming languages that is complexity of the language, productivity and development cost these are major issues in the other real time programming languages.
To overcome the problems associated with the normal java, RTSJ introduced the new concepts which allow developers to develop the real time applications using the java. The major enhancements are listed below.
RTSJ introduced the new threads for supporting the real time development. These are real time threads and non heap real time threads these threads are not intercept by the java garbage collector. The major functions of these threads are precise scheduling according the priority mentioned in the program without intercepted by garbage collector which is most important function for real time application development. The major enhancements are listed below.
Synchronization and resource scheduling
Asynchronous event handling
Asynchronous transfer of control
Asynchronous thread termination
Physical memory access
These major enchantments are discussed in the subsequent areas clearly and these features play a major significant role in the real time application development using the real time specifications for java.
4.3 Real-Time Specification for Java
RTSJ is a complete specification for development of predictable real-time Java-based applications. The basic core Java JVM is implemented the two new concepts that are thread priorities and memory area which is significantly effects the Real-Time application development. Real-Time Specification for Java (RTJS) addressed the main drawbacks which are present in the core java. The main issues are threading model, a and memory management and
4.3.1 Types of Java Thread
In Real-time applications deadlines are most important concepts, because of the garbage collector in core java critical tasks in Real-time systems lost their important deadlines. Because of the RTSJ implementation for core Java garbage collector performs three important tasks which are most vital for real-time programming, that is
Low-priority tasks are liberal with GC,
High-priority tasks cannot accept uncontrolled pre-emption latencies by the GC,
Critical tasks cannot tolerate pre-emption latencies by the GC 
In Java objected are created in the heap memory, less priority threads, or normal Java threads, are instances of the java.lang.Thread class. For Real-time applications high priority and critical threads are most vital elements, to support this RTJS implemented two new thread classes. These threads provide the perfect scheduling and perform the critical tasks.
Because of this implementation in RTJS, always highest priority threads are running. This is most vital element to develop the Real-time applications. The below figure shows the new thread implementation for core Java architecture.
Fig.184.108.40.206: New Types of Threads introduced by RTSJ.
This thread provides the implementation of RealtimeThread java class, because of this the java objects are not referenced to the heap memory. When the objects are not referenced to the heap memory the garbage collector is not eligible for clearing the java objects because of this feature high priority threads are always guaranteed the safe execution. NHRT must access only the scoped memory or immortal memory; it cannot access the heap memory any more.
4.3.3 Memory Management
In Real-time applications memory management is one of the key factors for successful execution of the real-time programs. RTJS has the three memory regions they are
We know that in core Java architecture heap memory is heavily influenced by the garbage collector, because of this reason core java is not suitable for machine critical applications, this is bypassed in the RTSJ implementation, this provides the safe memory management in RTJS.
"ImmortalMemory is a single memory area that is shared among all threads. Objects allocated in the immortal memory alive until the end of the application. In fact, unlike standard Java heap objects, immortal objects continue to exist even after there are no other references to them. Importantly, objects in immortal memory are never subject to garbage collection".(Ales PLSEK) .
Immortal Memory Heap Memory
Scoped Memory Instance
Scope Parenting Relation
Legal Memory reference
Scope A Scope B
Scoped Memory Reference
Fig.220.127.116.11: Memory areas defined by RTSJ
"ScopedMemory is an abstract base class for memory areas having limited lifetimes. A scoped memory area is valid as long as there are real-time threads with access to it" (Ales PLSEK) .
4.4 Advantages and Disadvantages of RTSJ
Ability to support the hard, soft and non-real time tasks in the same application.
Devloppers can predict execution timings and all other components before starting the process.
It has extensive libraries.
With the new memory paradigm we can prevent unexpected delays caused by the garbage collector.
Because of two new threads we can provide perfect thread scheduling and synchronization to the Real-Time applications.
We can give time garentee to the process to reach its deadlines.
In RTSJ we can get asynchronous event handling and transfer control.
In RTSJ application developpers can access ''physical memory'' directly.
RTSJ can keep all records of events happened, so developpers can delete unwanted events when ever they want.
Complexity of the RTSJ implementation.
Because of the three types of memory area complexity for the developer point of view.
RTSJ can not support ''debugging''. For this developpers should different interface called Desktop because RTSJ got choice of pluggable technology.
4.5 Real-time JVMs
To use the RTJS for Real-time application development, java virtual machine has to implement the RTJS application programming interface. There are many commercial RT-JVMs are available.
Name of the JVM
TimeSys RTSJ Reference Implementation
Java RTS Sun Java SE Real-time (Java RTS).
IBM WebSphere Real Time
JamaicaVM implements RTSJ and a deterministic garbage collector
jRate (Java Real-Time Extension)
JRockit Real-Time JRockit