Temadag om Java
JamaicaVM
Hard Realtime Response for Java Programs
Dr. Isabel Tonin
CEO, aicas
September 2013
2JamaicaVM: Realtime Response for Java Applications
Java Advantages
Deep Ecosystem
Large number of developers
Diverse middleware and libraries
Many development tools
Well defined language
Minimizes errors (strong typing w/ GC)
Security and memory model
Support for parallelism & distribution
Supports dynamic code loading (modules)
3JamaicaVM: Realtime Response for Java Applications
Real-Time Specification for Java
Realtime Tasking
Realtime threads
Event handling
Priority inversion
avoidance
Control Flow
Deadline Mon & Cntrl
Overrun Mon & Cntrl
ATC
Input/Output
Raw memory
POSIX events
Happenings
Memory Areas
Immortal
Scope
Physical
4JamaicaVM: Realtime Response for Java Applications
Java Problems
unpredictable pauses &
delays
Java nondeterminism
Java application size
Java performance
Java RTSJ Scoped Memory
complexity
Lack of Java on Embedded
Platforms
The JamaicaVM Solution
JamaicaVM Solution
Multithreaded, fully
preemptable Garbage
Collector (RTGC)
worst case execution time
analysis (WCETA) possible with
deterministic RTGC
Smart Linker reduces
executable size by up to 90%
ahead-of-time (AOT) compiler
delivers “native” compiled
code performance
no need for ScopedMemory
support for most embedded
OSes & CPUs including GENIVI
5JamaicaVM: Realtime Response for Java Applications
Realtime Java Technology
Static compiler technology with profiling
Faster code
Better time vs. space trade off
Smart linking
Only include what is necessary
Deterministic garbage collection
GC does not interrupt other (realtime) tasks
No pauses in the application
6JamaicaVM: Realtime Response for Java Applications
Deterministic Garbage Collection
Saves development time
No need to release objects explicitly
Fewer memory errors
Improves safety
Reduces the danger of memory leaks
Prevents premature object deallocation
Does not interfere with realtime response
7JamaicaVM: Realtime Response for Java Applications
Certifying a Garbage Collector
Not possible for all collector
Must be deterministic; no unbound steps
Must assume maximum memory use
Must consider allocation rate
Work Based Collector
No root scan and compaction (unbound)
Mark and sweep steps on fixed size blocks
Automatically tracks allocation rate
8JamaicaVM: Realtime Response for Java Applications
Conventional Garbage Collection
GC can interrupt execution for long periods of time:
Problem
long, unpredictable pauses during execution
9JamaicaVM: Realtime Response for Java Applications
RTSJ & Conventional Garbage Collection
No heap threads can interrupt garbage collector:
The application must be split into a realtime and a
nonrealtime part.
10JamaicaVM: Realtime Response for Java Applications
Realtime Garbage Collection
Paced garbage collector
Run GC at a high priority
Runs at given interval, for given amount of time
Programmer must provide both maximum memory use
and maximum allocation rate
Slack garbage collector
Run GC at lower priority than realtime tasks
Runs when processor cycles are available
Programmer must provide both maximum memory use
and maximum allocation rate
11JamaicaVM: Realtime Response for Java Applications
Realtime Garbage Collection
Work based garbage collector
No GC thread
GC borrows application thread
Need only determine maximum memory use
No read barriers needed
Low latency
12JamaicaVM: Realtime Response for Java Applications
Work-Based Garbage Collector
All Java Threads are realtime threads
GC work is performed at allocation time
GC work must be sufficient to recycle enough memory
before free memory is exhausted
Execution time of all allocations must be bound
13JamaicaVM: Realtime Response for Java Applications
JamaicaVM Builder Architecture
Default
Code Generator
Machine Code
Optimization
SSA Converter
Byte Code
Reader
Java Byte
Code
Intermediate
Code
SSA Blocks
Machine
Code
Object Code
Writer
SSA IC
Optimization
Machine Code
Generator
Machine Code
Generation Rules
SSA IC
Optimization Rules
Object Code
(ELF/PECOFF)
Machine Code
Optimization Rules
Processor
Definition
C Code
Generator
C Compilation
C Code
14JamaicaVM: Realtime Response for Java Applications
aicas Drives Standards Forward
Java Community Process
JSR 282: update Real-Time Specification for Java
JSR 302: Safety Critical Java
JSR 50: Distributed Realtime Java
SC-205/WG-71 Plenary
Update software standards for civil aviation:
DO-178, -248, -278, -330, -331, -332, and -333
Active in SG-5: Object Oriented Technology
Java Modeling Language (JML)
15JamaicaVM: Realtime Response for Java Applications
Major RTSJ Improvements
Raw Memory
Typed device access
Factory based
ActiveEvents
Unify API for Timer,
Happening, & Signal
Happening object
ISR Support
Stateful Events &
Handlers
Object & long
POSIX Realtime Signal
CPU Affinity
New Scope types
PinnableMemory
StackedMemory
16JamaicaVM: Realtime Response for Java Applications
Applications
17JamaicaVM: Realtime Response for Java Applications
JamaicaVM vs. Oracle’s JDK
JamaicaVM
Realtime GC
no GC pauses
Supports realtime
priorities w/ OS map
RTSJ APIs
RealtimeThread,
AsyncEvent, etc.
Static compilation
Flexible license
Oracle’s JDK
Conventional GC
GC causes pauses
Priorities ill defined
w/o mapping to OS
No RTSJ support, just
standard classes
JIT Only
One for all license
(not free)
18JamaicaVM: Realtime Response for Java Applications
Conclusion
State-of-the-art Java technology
Realtime garbage collection
Compilation and linking technology
Complete RTSJ implementation
multicore support
Market proven products
Dedicated to standards
Tools to ensure your system works correctly

Temadag om-java-jamaica vm-2013-09

  • 1.
    Temadag om Java JamaicaVM HardRealtime Response for Java Programs Dr. Isabel Tonin CEO, aicas September 2013
  • 2.
    2JamaicaVM: Realtime Responsefor Java Applications Java Advantages Deep Ecosystem Large number of developers Diverse middleware and libraries Many development tools Well defined language Minimizes errors (strong typing w/ GC) Security and memory model Support for parallelism & distribution Supports dynamic code loading (modules)
  • 3.
    3JamaicaVM: Realtime Responsefor Java Applications Real-Time Specification for Java Realtime Tasking Realtime threads Event handling Priority inversion avoidance Control Flow Deadline Mon & Cntrl Overrun Mon & Cntrl ATC Input/Output Raw memory POSIX events Happenings Memory Areas Immortal Scope Physical
  • 4.
    4JamaicaVM: Realtime Responsefor Java Applications Java Problems unpredictable pauses & delays Java nondeterminism Java application size Java performance Java RTSJ Scoped Memory complexity Lack of Java on Embedded Platforms The JamaicaVM Solution JamaicaVM Solution Multithreaded, fully preemptable Garbage Collector (RTGC) worst case execution time analysis (WCETA) possible with deterministic RTGC Smart Linker reduces executable size by up to 90% ahead-of-time (AOT) compiler delivers “native” compiled code performance no need for ScopedMemory support for most embedded OSes & CPUs including GENIVI
  • 5.
    5JamaicaVM: Realtime Responsefor Java Applications Realtime Java Technology Static compiler technology with profiling Faster code Better time vs. space trade off Smart linking Only include what is necessary Deterministic garbage collection GC does not interrupt other (realtime) tasks No pauses in the application
  • 6.
    6JamaicaVM: Realtime Responsefor Java Applications Deterministic Garbage Collection Saves development time No need to release objects explicitly Fewer memory errors Improves safety Reduces the danger of memory leaks Prevents premature object deallocation Does not interfere with realtime response
  • 7.
    7JamaicaVM: Realtime Responsefor Java Applications Certifying a Garbage Collector Not possible for all collector Must be deterministic; no unbound steps Must assume maximum memory use Must consider allocation rate Work Based Collector No root scan and compaction (unbound) Mark and sweep steps on fixed size blocks Automatically tracks allocation rate
  • 8.
    8JamaicaVM: Realtime Responsefor Java Applications Conventional Garbage Collection GC can interrupt execution for long periods of time: Problem long, unpredictable pauses during execution
  • 9.
    9JamaicaVM: Realtime Responsefor Java Applications RTSJ & Conventional Garbage Collection No heap threads can interrupt garbage collector: The application must be split into a realtime and a nonrealtime part.
  • 10.
    10JamaicaVM: Realtime Responsefor Java Applications Realtime Garbage Collection Paced garbage collector Run GC at a high priority Runs at given interval, for given amount of time Programmer must provide both maximum memory use and maximum allocation rate Slack garbage collector Run GC at lower priority than realtime tasks Runs when processor cycles are available Programmer must provide both maximum memory use and maximum allocation rate
  • 11.
    11JamaicaVM: Realtime Responsefor Java Applications Realtime Garbage Collection Work based garbage collector No GC thread GC borrows application thread Need only determine maximum memory use No read barriers needed Low latency
  • 12.
    12JamaicaVM: Realtime Responsefor Java Applications Work-Based Garbage Collector All Java Threads are realtime threads GC work is performed at allocation time GC work must be sufficient to recycle enough memory before free memory is exhausted Execution time of all allocations must be bound
  • 13.
    13JamaicaVM: Realtime Responsefor Java Applications JamaicaVM Builder Architecture Default Code Generator Machine Code Optimization SSA Converter Byte Code Reader Java Byte Code Intermediate Code SSA Blocks Machine Code Object Code Writer SSA IC Optimization Machine Code Generator Machine Code Generation Rules SSA IC Optimization Rules Object Code (ELF/PECOFF) Machine Code Optimization Rules Processor Definition C Code Generator C Compilation C Code
  • 14.
    14JamaicaVM: Realtime Responsefor Java Applications aicas Drives Standards Forward Java Community Process JSR 282: update Real-Time Specification for Java JSR 302: Safety Critical Java JSR 50: Distributed Realtime Java SC-205/WG-71 Plenary Update software standards for civil aviation: DO-178, -248, -278, -330, -331, -332, and -333 Active in SG-5: Object Oriented Technology Java Modeling Language (JML)
  • 15.
    15JamaicaVM: Realtime Responsefor Java Applications Major RTSJ Improvements Raw Memory Typed device access Factory based ActiveEvents Unify API for Timer, Happening, & Signal Happening object ISR Support Stateful Events & Handlers Object & long POSIX Realtime Signal CPU Affinity New Scope types PinnableMemory StackedMemory
  • 16.
    16JamaicaVM: Realtime Responsefor Java Applications Applications
  • 17.
    17JamaicaVM: Realtime Responsefor Java Applications JamaicaVM vs. Oracle’s JDK JamaicaVM Realtime GC no GC pauses Supports realtime priorities w/ OS map RTSJ APIs RealtimeThread, AsyncEvent, etc. Static compilation Flexible license Oracle’s JDK Conventional GC GC causes pauses Priorities ill defined w/o mapping to OS No RTSJ support, just standard classes JIT Only One for all license (not free)
  • 18.
    18JamaicaVM: Realtime Responsefor Java Applications Conclusion State-of-the-art Java technology Realtime garbage collection Compilation and linking technology Complete RTSJ implementation multicore support Market proven products Dedicated to standards Tools to ensure your system works correctly