Enhancements to Java for Real Time Systems Theresa Dsena CSE Fall 2006 Prof. Ganesan
CSE Fall /10/06 Contents Limitations of Standard Java Overview of RTSJ Guiding Principles of RTSJ Enhancements to Standard Java Concluding notes on RTSJ
CSE Fall /10/06 Limitations of Standard Java Major Weakness Garbage Collection The garbage collector de-allocates objects from the memory heap in no particular order. This non-deterministic behavior could interrupt application execution for unpredictable intervals of time Thread Scheduling The JVM (Java Virtual Machine) relies on the host operating systems thread scheduler. The operating system must be capable of real-time scheduling
CSE Fall /10/06 Overview of RTSJ The Real Time for Java Experts Group (RTJEG) has been developing Real Time Specification for Java (RTSJ) since 1999 under the Java community process RTSJ specifies enhancements to standard Java, specifically for JVM and creation of real time API
CSE Fall /10/06 Guiding Principles of RTSJ Applicability to all Java environments Backward compatibility Write once, run anywhere Current real time practices and future implementations Priority to predictable execution
CSE Fall /10/06 Enhancements to Standard Java Thread scheduling and dispatching Memory management Thread synchronization Asynchronous event handling Asynchronous transfer of control Asynchronous thread termination Physical memory access
CSE Fall /10/06 Enhancements to Standard Java - Thread Scheduling RTSJ requires a base scheduler that provides Preemptive and priority based execution A minimum of 28 unique priorities Define classes for execution eligibility and schedule feasibility
CSE Fall /10/06 Enhancements to Standard Java - Memory Management Garbage collection in standard Java is unsuitable for real-time threads RTSJ introduces the concept of memory areas Heap memory – Standard Java heap Immortal memory – Shared among threads Scoped memory – For objects with a well- defined lifetime
CSE Fall /10/06 Enhancements to Standard Java – Thread synchronization Priority queuing on synchronized blocks Implementation of Java keyword Synchronized includes algorithm for priority inversion Wait free queues
CSE Fall /10/06 Enhancements to Standard Java – Asynchronous event handling Real time application must respond to asynchronous real world events RTSJ includes Asynchronous events Asynchronous event handlers
CSE Fall /10/06 Enhancements to Standard Java – Asynchronous thread termination Drastic and asynchronous changes in the real world may require a java thread to safely transfer its control and terminate RTSJ includes thread interruption with Asynchronous Transfer of Control (ATC) thread handlers
CSE Fall /10/06 Enhancements to Standard Java – Physical memory address RTSJ includes direct access to physical memory A class that allows programmers byte level access to physical memory A class that allows creation of objects in physical memory
CSE Fall /10/06 Concluding notes Java’s main problem for use in real time applications is unsuitable memory management RTSJ originated from the desire to use Java in real time applications Real time Java is emerging
CSE Fall /10/06 References
Thank You