Presentation is loading. Please wait.

Presentation is loading. Please wait.

Embedded Java Research Geoffrey Beers Peter Jantz December 18, 2001.

Similar presentations


Presentation on theme: "Embedded Java Research Geoffrey Beers Peter Jantz December 18, 2001."— Presentation transcript:

1 Embedded Java Research Geoffrey Beers Peter Jantz December 18, 2001

2 Advantages of the Java Technology Model Simplicity Simplicity –Easier language to learn than traditional C/C++ and still has object-oriented methodology. Security and Safety Security and Safety –Java programs have more robust security checking, with the RTE creating a “sandbox” where applications can run safely. –Lack of pointers eliminates direct memory access Portability and Robust Distribution Portability and Robust Distribution –Applications can be easily developed on desktop systems and ported, with minimal effort, to target device. –“Write-once, run anywhere” mentality.

3 Disadvantages of Embedded Java Huge speed disadvantage. Interpreted Java code is still 5-10 times slower than a similar C application. Huge speed disadvantage. Interpreted Java code is still 5-10 times slower than a similar C application. –Improvements made to JVM technology have enhanced this over the years. –Often based on how the application is written »A well-written Java program can out-perform a poorly written C program –For embedded applications do we really need to interpret code, or can we use native-compiled code?

4 Disadvantages of Embedded Java Embedded Java technology still relatively new and industry support has been slow to catch-on. Embedded Java technology still relatively new and industry support has been slow to catch-on. Biggest disadvantage: Lack of RTOS support or standard Biggest disadvantage: Lack of RTOS support or standard –Early embedded Java applications were very similar to conventional desktop programs. Fine for some apps, but deadline control and interrupt handling are necessary. –Great improvement in this genre since 1998.

5 Real-Time Specification for Java Guiding Principles Applicability to particular Java environments. Applicability to particular Java environments. –Do not include specs that restrict use to a particular Java environment. Backward compatibility Backward compatibility –RTSJ shall not prevent existing, non real-time Java programs, from executing on implementations of the RTSJ. “Write once, run anywhere” mentality should be followed as much as possible. “Write once, run anywhere” mentality should be followed as much as possible.

6 RTSJ Guiding Principles (cont.) RTSJ should address real-time system practice and allow for the incorporation of advanced features in the future. RTSJ should address real-time system practice and allow for the incorporation of advanced features in the future. Predictable execution as first priority in all tradeoffs. Predictable execution as first priority in all tradeoffs. –May come at expense of general-computing performance, but will allow for greater real-time integration. No syntactic extension No syntactic extension –RTSJ will not introduce new keywords or other syntactic extension to the Java language.

7 Real-Time Specification for Java Finalized in November 2001. Finalized in November 2001. Standard specification for garbage collection, memory management, and task/thread control. Standard specification for garbage collection, memory management, and task/thread control. Additional classes and extensions to standard Java JDK. Additional classes and extensions to standard Java JDK. –However, no new syntax was necessary.

8 javax.realtime Package Real-time specification provides modifications to the Java Language Spec. and JVM Spec. Real-time specification provides modifications to the Java Language Spec. and JVM Spec. New APIs to enable the creation, verification, analysis, execution, and management of real-time Java threads. New APIs to enable the creation, verification, analysis, execution, and management of real-time Java threads. New APIs in a standard extension package, javax.realtime. New APIs in a standard extension package, javax.realtime.

9 Seven Areas of Enhancement Thread scheduling and dispatching Thread scheduling and dispatching Memory management Memory management Synchronization and resource sharing Synchronization and resource sharing Asynchronous event handling Asynchronous event handling Asynchronous transfer of control Asynchronous transfer of control Thread termination Thread termination Physical memory access Physical memory access

10 Four Memory Areas Scoped Memory Scoped Memory –Objects have lifetime defined by syntactic scope. Physical Memory Physical Memory –Objects created within specific physical memory regions having certain characteristics. Immortal Memory Immortal Memory –Objects cannot be destroyed; once allocated they stay until the end of the application. Heap Memory Heap Memory –Objects represent an area of memory on the heap.

11 Asynchronous Events Some internal or external event that happens. Some internal or external event that happens. –Not all real-life events are predictable in time and frequency. System needs to respond to the changing environment. System needs to respond to the changing environment. –Ability of real-time systems to react to the events requires reliable asynchrony techniques.

12 Major Platforms Supported Operating Systems Operating Systems –Windows CE –Linux Processors Processors –PicoJava – Sun’s Java Processor –StrongArm –MIPs –Intel

13 Java and Embedded Linux Java does I/O by opening files which are the Linux device drivers (ex: /dev/mem). Java can seek in addition to read, write and open. Java does I/O by opening files which are the Linux device drivers (ex: /dev/mem). Java can seek in addition to read, write and open. Bootstrapping allows Linux to load necessary drivers and networking files and start running the JVM. Bootstrapping allows Linux to load necessary drivers and networking files and start running the JVM. Standard Linux distributions with networking support require lots of memory. Standard Linux distributions with networking support require lots of memory.

14 Improving Performance Java bytecode programs are typically 10 times slower than programs written in C or C++. Java bytecode programs are typically 10 times slower than programs written in C or C++. How well the program is written is more important. A well-written Java program can equal the efficiency of an average-written C/C++ program. How well the program is written is more important. A well-written Java program can equal the efficiency of an average-written C/C++ program. Interpreting code uses less ROM. Interpreting code uses less ROM.

15 Compilation into Native Code AOT (Ahead of time) AOT (Ahead of time) JIT (Just in time) JIT (Just in time) Dynamic Compilation Dynamic Compilation

16 AOT Compilation Similar to C compilers Similar to C compilers Tends to create large executables Tends to create large executables Need to re-compile for different platforms or when loading a different class Need to re-compile for different platforms or when loading a different class Can compile everything including class libraries Can compile everything including class libraries

17 JIT Compilation Machine independent Machine independent Higher startup cost Higher startup cost Not ideal for embedded systems Not ideal for embedded systems –Requires fast CPU, lots of virtual memory and a fast disk drive for paging

18 Dynamic Compilation Dynamically compiles code that is being used more frequently Dynamically compiles code that is being used more frequently Typically uses JIT compilers Typically uses JIT compilers Doesn’t require virtual memory, adaptable to available system memory Doesn’t require virtual memory, adaptable to available system memory Isn’t guaranteed to meet timing constraints Isn’t guaranteed to meet timing constraints –Applications can change the compiler’s thread priority for greater predictability

19 Other Methods to improve Performance Static Linking - place bytecode into ROM Static Linking - place bytecode into ROM Re-write bytecode interpreter in assembly language Re-write bytecode interpreter in assembly language Use a Java Chip Use a Java Chip

20 Conclusions and Summaries Recent advances in embedded Java technology and advent of RTSJ are allowing real-time capabilities and possibilities in the Java world. Recent advances in embedded Java technology and advent of RTSJ are allowing real-time capabilities and possibilities in the Java world. Many current embedded Java systems are non real-time or a limited subset of RTSJ principles. Many current embedded Java systems are non real-time or a limited subset of RTSJ principles. Sun’s advancements and broad range of distribution environments make embedded Java programming much simpler and more robust. Sun’s advancements and broad range of distribution environments make embedded Java programming much simpler and more robust.


Download ppt "Embedded Java Research Geoffrey Beers Peter Jantz December 18, 2001."

Similar presentations


Ads by Google