JamaicaVM Java for Embedded Realtime Systems

Similar documents
Hard Real-Time Garbage Collection in Java Virtual Machines

Configuring the Heap and Garbage Collector for Real- Time Programming.

A High Integrity Distributed Deterministic Java Environment. WORDS 2002 January 7, San Diego CA

High-Level Language VMs

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley

Managed runtimes & garbage collection

Limits of Parallel Marking Garbage Collection....how parallel can a GC become?

Fiji VM Safety Critical Java

Heap Compression for Memory-Constrained Java

Garbage Collection. Hwansoo Han

Run-Time Environments/Garbage Collection

Java On Steroids: Sun s High-Performance Java Implementation. History

A new Mono GC. Paolo Molaro October 25, 2006

Run-time Environments -Part 3

Hard Real-Time Garbage Collection in the Jamaica Virtual Machine

The Impact of a Real-Time JVM on Middleware Performance: Lessons Learned from Implementing DDS on IBM s J9

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java)

A program execution is memory safe so long as memory access errors never occur:

SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine p. 1

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

6.172 Performance Engineering of Software Systems Spring Lecture 9. P after. Figure 1: A diagram of the stack (Image by MIT OpenCourseWare.

Safety Critical Java. Language Standards and Analysis Techniques for Java in Safety Critical applications. aicas GmbH

Garbage Collection Algorithms. Ganesh Bikshandi

Using Java in Safety-Critical Applications

Memory management has always involved tradeoffs between numerous optimization possibilities: Schemes to manage problem fall into roughly two camps

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime

Run-time Environments - 3

New Java performance developments: compilation and garbage collection

Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java

Project. there are a couple of 3 person teams. a new drop with new type checking is coming. regroup or see me or forever hold your peace

Pause-Less GC for Improving Java Responsiveness. Charlie Gracie IBM Senior Software charliegracie

JamaicaVM 6.0 User Manual

Name, Scope, and Binding. Outline [1]

Eclipse Tool Chain for Smart Development of High-Tech / Low Cost Embedded Systems

KESO Functional Safety and the Use of Java in Embedded Systems

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

Memory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008

Real-Time Garbage Collection Panel JTRES 2007

6.828: OS/Language Co-design. Adam Belay

JDK 9/10/11 and Garbage Collection

DNWSH - Version: 2.3..NET Performance and Debugging Workshop

JVM Memory Model and GC

Compilers. 8. Run-time Support. Laszlo Böszörmenyi Compilers Run-time - 1

Motivation for Dynamic Memory. Dynamic Memory Allocation. Stack Organization. Stack Discussion. Questions answered in this lecture:

A JVM Does What? Eva Andreasson Product Manager, Azul Systems

Performance of Non-Moving Garbage Collectors. Hans-J. Boehm HP Labs

Jaguar: Enabling Efficient Communication and I/O in Java

Using the Singularity Research Development Kit

Dynamic Storage Allocation

Untyped Memory in the Java Virtual Machine

Compiler Construction

Binding and Storage. COMP 524: Programming Language Concepts Björn B. Brandenburg. The University of North Carolina at Chapel Hill

CSE P 501 Compilers. Memory Management and Garbage Collec<on Hal Perkins Winter UW CSE P 501 Winter 2016 W-1

Interaction of JVM with x86, Sparc and MIPS

Implementation Garbage Collection

CS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers

Compiler Construction

The Z Garbage Collector An Introduction

Robust Memory Management Schemes

JOP: A Java Optimized Processor for Embedded Real-Time Systems. Martin Schoeberl

Chapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

Automatic Memory Management

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1

Java Internals. Frank Yellin Tim Lindholm JavaSoft

Field Analysis. Last time Exploit encapsulation to improve memory system performance

NG2C: Pretenuring Garbage Collection with Dynamic Generations for HotSpot Big Data Applications

Running class Timing on Java HotSpot VM, 1

Evolution of Virtual Machine Technologies for Portability and Application Capture. Bob Vandette Java Hotspot VM Engineering Sept 2004

Garbage Collection. Akim D le, Etienne Renault, Roland Levillain. May 15, CCMP2 Garbage Collection May 15, / 35

Garbage Collection. Weiyuan Li

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru Department of Electronics and Communication Engineering

Garbage Collection. Steven R. Bagley

I J C S I E International Science Press

The Z Garbage Collector Low Latency GC for OpenJDK

Exploiting the Behavior of Generational Garbage Collector

Trace-based JIT Compilation

Garbage Collection (2) Advanced Operating Systems Lecture 9

NUMA in High-Level Languages. Patrick Siegler Non-Uniform Memory Architectures Hasso-Plattner-Institut

CS 345. Garbage Collection. Vitaly Shmatikov. slide 1

One-Slide Summary. Lecture Outine. Automatic Memory Management #1. Why Automatic Memory Management? Garbage Collection.

Eventrons: A Safe Programming Construct for High-Frequency Hard Real-Time Applications

Coping with Immutable Data in a JVM for Embedded Real-Time Systems. Christoph Erhardt, Simon Kuhnle, Isabella Stilkerich, Wolfgang Schröder-Preikschat

CS577 Modern Language Processors. Spring 2018 Lecture Garbage Collection

Lecture 8 Dynamic Memory Allocation

Compiler construction 2009

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Requirements, Partitioning, paging, and segmentation

The Memory Management Unit. Operating Systems. Autumn CS4023

Manual Allocation. CS 1622: Garbage Collection. Example 1. Memory Leaks. Example 3. Example 2 11/26/2012. Jonathan Misurda

Run-time Program Management. Hwansoo Han

Lecture Notes on Advanced Garbage Collection

Run-time Environments

Run-time Environments

Windows Java address space

Optimizing the Generation of Object-Oriented Real-Time Embedded Applications Based on the Real-Time Specification for Java

Introduction to Java Programming

Computers in Engineering COMP 208. Computer Structure. Computer Architecture. Computer Structure Michael A. Hawker

JAVA ON HANDHELD DEVICES COMPARING J2ME CDC TO JAVA 1.1 AND JAVA 2

Transcription:

JamaicaVM Java for Embedded Realtime Systems... bringing modern software development methods to safety critical applications Fridtjof Siebert, 25. Oktober 2001 1

Deeply embedded applications Examples: automotive, avionic, industrial automation, telecommunication, medical,... 2

Why Java for systems? Higher productivity Plattform indepence Reliability (type/pointer safe) Flexibility (dynamic loading) Problems: Memory requirements Poor runtime performance Lack of guarantees 3

The JamaicaVM Static Compiler Java Application Builder Standard Classes Analyser Profiler Jamaica Virtual Machine Realtime GC JNI Native Code of Application Realtime OS JamaicaVM 4

JamaicaVM Java-Implementatation based on JDK 1.2 Exact garbage collector without GC interruptions and guaranteed allocation time of a few µs. Builder Tool to create small and efficient applicats for embedded systems. static, optimizing compiler for maximum performance Java Native Interface to access existing code 5

Classic Garbage Collection GC can stop execution for long periods of time: Thread: time GC User 1 User 2... 6

real-time Java extensions Support for real-time threads: Thread: rt1 rt2 GC User 1 User 2... time The application must be split into a and non- part. Synchronization between these parts is not possible! 7

JamaicaVM: threads All Java threads are threads: Thread: rt1 rt2 rt3 rt4... time All garbage collection work is performed at allocation time. GC work is sufficient to finish GC cycle before memory is exhausted. WCET for an allocation can be given. 8

Typical GC cycle Root Scanning Mark Sweep Compact Mark objects referenced from outside the heap Recursively mark all reachable objects Free memory of unmarked objects Move allocated memory to get contiguous free range 9

GC Cycle in JamaicaVM Root Scanning Mark Sweep Compact Constant-time root scanning (compiler support) Incremental mark & sweep collector using very small increments of work Non-Fragmenting object layout: No compaction required! 10

Example: GC configuration Measure heap requirement of test application: > jamaica -analyse 5 TestApp >./TestApp [... out of TestApp...] ### Application used at most 117224 bytes for Java heap ### ### heapsize wcet dynamic ### 397k 6 ### 331k 7 ### 240k 10 ### 195k 14 ### 182k 16 ### 166k 20 ### 150k 28 ### 138k 40 ### 122k 128 ### 118k 256 11

Example: GC configuration Determination of worst-case execution time of new StringBuffer() First, determine number of blocks used by object: > numblocks java.lang.stringbuffer 1 Then, determine Worst-case execution time: wcet = numblocks * max gc * wcet gc_unit : wcet 166k = 1 * 20 * 2µs = 40µs wcet 331k = 1 * 07 * 2µs = 14µs 12

Further challanges for a implementation of Java Dynamic calls (virtual calls, interface calls) require constant-time execution Type checks and casts require constant-time execution Class initialisation early initialisation would change semantics Synchronization (monitors) must be inlined for deterministic behaviour 13

The Jamaica Builder Create single application out of Class files and JamaicaVM: compaction smart linking compilation analysis profiling... Java Class Java File Class Java File Class Java File Class File Options Jamaica Builder stand-alone Application Profiling data C source file Linker C- Compiler Objectfile Jamaica Jamaica VM files Jamaica VM files VM files 14

Reducing Memory Demand Classfile compaction: Avoid redundancies in the Java classfile format. Saves typically 50% of memory. Example: classes of emb. Caffeine: 334630 bytes after compaction: 149268 bytes (-55%) 15

Reducing Memory Demand Smart linking Analyse application and remove unused code. Together with compaction, this saves 80-90% of memory. Example: classes of emb. Caffeine: 334630 bytes comp. + smart linking: 023280 bytes (-93%) But: User attention required when dynamic class loading or reflection API is used! 16

Reducing Memory Demand RAM requirements Execute bytecodes from ROM Small overhead for Java objects and arrays: type information (class, array length) hash code monitor Small GC overhead location of references GC state of object finalization state of object 17

Execution Speed Use of compilation is required, but Just-in-Time-Compilation not deterministic and not applicable in systems Flash-Compilation (at load time) deterministic, but requires memory for compiler on target memory for compiled code 18

JamaicaVM: Optimizing Static Compiler Compile at build time: No compilation on target system to avoid overhead (memory, time) and unpredictability of JIT-compilation. Allow mixing of compiled and interpreted code: enables small footprint and dynamic loading. Typical speedup factor 20-25. 19

Profile guided compilation Compiled code requires significantly more memory than interpreted bytecode. Compiling a small percentage is sufficient:. compiled caffeine score speedup code size 000% 0202 01.0 174 784 001% 1399 06.9 188 384 002% 3533 17.5 190 592 005% 6728 33.3 194 176 010% 7751 38.4 202 368 020% 7546 37.4 221 376 050% 7779 38.5 258 816 100% 7788 38.6 268 512 all 7792 38.6 305 760 20

Integration of native code Often, C/C++ needs to be accessed to Use system features Access library code Integrate legacy code JamaicaVM provides two means to perform this JNI Standard Java Native Interface Portable betweent differen VMs JBI Jamaica Binary Interface Optimized for efficient access. 21

Conclusion Java can be used even in deeply embedded applications with limited resources and need for behaviour. Object-oriented Java programming using dynamic allocation is possible even for time-critical code. This brings higher productivity, reliability, deterministic execution and easy code resuse and capsulation. 22