Compilation Technology © 2007 IBM Corporation CGO 20072007-03-13 Performance Overheads In Real-Time Java Programs Mark Stoodley and Mike Fulton Compilation.

Slides:



Advertisements
Similar presentations
IBM JIT Compilation Technology AOT Compilation in a Dynamic Environment for Startup Time Improvement Kenneth Ma Marius Pirvu Oct. 30, 2008.
Advertisements

Extensibility, Safety and Performance in the SPIN Operating System Presented by Allen Kerr.
Lab#1 (14/3/1431h) Introduction To java programming cs425
Model for Supporting High Integrity and Fault Tolerance Brian Dobbing, Aonix Europe Ltd Chief Technical Consultant.
Chapter 13 Embedded Systems
IBM Software Group © 2005 IBM Corporation Compilation Technology Toward Deterministic Java Performance Mark Stoodley, Mike Fulton Toronto Lab, IBM Canada.
0 Parallel and Concurrent Real-time Garbage Collection Part I: Overview and Memory Allocation Subsystem David F. Bacon T.J. Watson Research Center.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Compilation Technology October 17, 2005 © 2005 IBM Corporation Software Group Reducing Compilation Overhead in J9/TR Marius Pirvu, Derek Inglis, Vijay.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
Dynamic Tainting for Deployed Java Programs Du Li Advisor: Witawas Srisa-an University of Nebraska-Lincoln 1.
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
© Andy Wellings, 2003 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© 2007 IBM Corporation IBM Software Group September 26, 2007 Tactics for Minimal Interference from Class Loading in Real-Time Java™ The 5th International.
Reference Types. 2 Objectives Introduce reference types –class –array Discuss details of use –declaration –allocation –assignment –null –parameter –aggregation.
CprE 458/558: Real-Time Systems
The Design of Robust and Efficient Microkernel ManRiX, The Design of Robust and Efficient Microkernel Presented by: Manish Regmi
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Copyright Arshi Khan1 System Programming Instructor Arshi Khan.
Memory Management for Real-Time Java Wes Beebee and Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Supported by: DARPA.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 1.
Embedded Java Research Geoffrey Beers Peter Jantz December 18, 2001.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
JOP: A Java Optimized Processor for Embedded Real-Time Systems Martin Schöberl.
Real-Time Java Martin Schöberl. Real Time Java2 Overview What are real-time systems Real-time specification for Java RTSJ issues, subset Real-time profile.
Real-Time Java on JOP Martin Schöberl. Real-Time Java on JOP2 Overview RTSJ – why not Simple RT profile Scheduler implementation User defined scheduling.
Real-Time Systems Design1 Priority Inversion When a low-priority task blocks a higher-priority one, a priority inversion is said to occur Assume that priorities:
Java Virtual Machine Case Study on the Design of JikesRVM.
A Mostly Non-Copying Real-Time Collector with Low Overhead and Consistent Utilization David Bacon Perry Cheng (presenting) V.T. Rajan IBM T.J. Watson Research.
Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.
Enhancements to Java for Real Time Systems Theresa Dsena CSE Fall 2006 Prof. Ganesan.
IBM Software Group, Compilation Technology © 2007 IBM Corporation Some Challenges Facing Effective Native Code Compilation in a Modern Just-In-Time Compiler.
The Performance of Micro-Kernel- Based Systems H. Haertig, M. Hohmuth, J. Liedtke, S. Schoenberg, J. Wolter Presentation by: Seungweon Park.
Instrumentation in Software Dynamic Translators for Self-Managed Systems Bruce R. Childers Naveen Kumar, Jonathan Misurda and Mary.
Fall 2013 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.
1 G53SRP: Introduction to Real Time Specification for Java (RTSJ) Chris Greenhalgh School of Computer Science Including material © Andy Wellings from his.
EEL The Real-Time Specification for Java (1)
Real-Time, Clocking, and Porting (My Job ) Determining the Real Time Capabilities of various Operating Systems. Writing code to support Real Time Clocking.
Introducing Allors Applications, Tools & Platform.
111 G53SRP: RTSJ Memory Areas Chris Greenhalgh School of Computer Science.
Patterns and Tools for Achieving Predictability and Performance with Real-time Java Presenter: Ehsan Ghaneie.
CSCI1600: Embedded and Real Time Software Lecture 18: Real Time Languages Steven Reiss, Fall 2015.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Real Time System with MVL. © 2007 MontaVista Confidential | Overview of MontaVista Agenda Why Linux Real Time? Linux Kernel Scheduler Linux RT technology.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
Vertical Profiling : Understanding the Behavior of Object-Oriented Applications Sookmyung Women’s Univ. PsLab Sewon,Moon.
Real-Time Operating System Design
Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages.
Real-Time Operating Systems RTOS For Embedded systems.
(Not too) Real-Time JVM (Progress Report)
A New kind of real-time: Enterprise Real-time
Context-related issues in real-time systems
REAL-TIME OPERATING SYSTEMS
Before You Begin Nahla Abuel-ola /WIT.
Current Generation Hypervisor Type 1 Type 2.
Introduction to the CVM and the Timesys RI
Introduction Enosis Learning.
Real-time Software Design
Introduction Enosis Learning.
CSCI1600: Embedded and Real Time Software
Adaptive Code Unloading for Resource-Constrained JVMs
Real Time Java : Synchronization
CSCI1600: Embedded and Real Time Software
(Computer fundamental Lab)
JIT Compiler Design Maxine Virtual Machine Dhwani Pandya
Nikola Grcevski Testarossa JIT Compiler IBM Toronto Lab
Presentation transcript:

Compilation Technology © 2007 IBM Corporation CGO Performance Overheads In Real-Time Java Programs Mark Stoodley and Mike Fulton Compilation Technology IBM Toronto Lab

Compilation Technology © 2003 IBM Corporation 2CGO Outline  What is Real Time?  Java and Real-Time Systems  IBM WebSphere Real Time  Overheads  Some Preliminary Results  Summary

Compilation Technology © 2003 IBM Corporation 3CGO What is a “Real Time” Application  Characterized by activities that have deadlines –Often involve interactions with physical world  Several facets to real-time requirements –Fault tolerance: what happens when deadline missed? –Level of determinism: allowable variance? –Response time: how long do we have?  Maxim: real-time is not just real-fast  Not just embedded systems –Transaction processing, complex middleware systems

Compilation Technology © 2003 IBM Corporation 4CGO Traditional Java and Real Time Systems  Real-Time systems need deterministic behaviour –Predictable performance enables robust design  Determinism not one of Java’s strengths –Class loading, garbage collection, JIT compilation  Traditional performance focus on average case –Worst case performance matters more for real-time apps  Must balance determinism and raw performance –Customers say “real-slow is not real-good”

Compilation Technology © 2003 IBM Corporation 5CGO The Real Time Specification for Java (RTSJ)  JSR #1  Augments Java with tools to engineer RT systems –Threading, scheduling, memory management, event handling, asynchrony, time, physical memory access  Large and complex specification –470 pages! (JVM spec is 472 pages)  No syntax changes to the language –Substantial new class library support –JVM implementation and OS implications

Compilation Technology © 2003 IBM Corporation 6CGO Example: Realtime and NoHeapRealtime Threads  RTSJ introduces new RealtimeThread class –Extends java/lang/Thread –Can specify scheduling policies, release parameters  Also NoHeapRealtimeThread –Extends RealtimeThread –Created for tasks that cannot tolerate GC interruptions –NHRTs not allowed to observe heap references –New programmer-managed memory areas introduced Immortal, scopes

Compilation Technology © 2003 IBM Corporation 7CGO IBM WebSphere Real Time  Released end of August 2006  Fully compliant RTSJ implementation –Built on IBM’s J9 virtual machine technology  Engineered to meet customer requirements over and above what’s required by the RTSJ  Significant new features: 1.Real-time Linux kernel patches (open source model) 2.Metronome deterministic GC 3.Ahead-Of-Time (AOT) native code compilation

Compilation Technology © 2003 IBM Corporation 8CGO Overheads in Real-Time Native Code  Overheads for RTSJ –NoHeapRealtimeThread memory checks –Scope memory checks –Asynchronous Transfer of Control support  Overheads for Metronome GC –GC is incremental so need write barriers –Arraylets object model –If defragmentation supported, need read barriers  Not strictly “overheads”, but: –Many optimizations also disabled to promote determinism –Ahead-Of-Time compiled code typically slower than JITed code

Compilation Technology © 2003 IBM Corporation 9CGO NoHeapRealtimeThread (NHRT) Memory Checks  NHRTs cannot load heap references –Exception must be thrown if heap reference found  NHRT checks inserted all over the place, ahead of –Parameter loads –Instance and static field loads –Call returns –Reference array element loads –Exception object load –(New object allocations)

Compilation Technology © 2003 IBM Corporation 10CGO Generated Code for NHRTCheck operation NHRTCheck:test[ebp+#flags], #bitmask ; thread is NHRT? jzCheckDone cmpeax, jbCheckDone cmpeax, jaCheckDone pushebp; found heap ref, need to throw pusheax; MemoryAccessError exception calljitThrowMemoryAccessError CheckDone:

Compilation Technology © 2003 IBM Corporation 11CGO Why not put reference check into a snippet?  Motivation: most threads are not NHRTs –We discourage this thread type unless truly needed  NHRTChecks are plentiful –number of branches overloads processor’s BHT –Processor resorts to default forward branch prediction: fall-through –Only gets it right for NHRTs   Natural candidate for snippet generation

Compilation Technology © 2003 IBM Corporation 12CGO NHRTCheck operation with heap ref snippet NHRTCheck:test[ebp+#flags], #bitmask ; thread is NHRT? jnzSnippet CheckDone:… Snippet:cmpeax, jbCheckDone cmpeax, jaCheckDone pushebp; found heap ref, need to throw pusheax; MemoryAccessError exception calljitThrowMemoryAccessError

Compilation Technology © 2003 IBM Corporation 13CGO Performance Results Lower is better Higher is better

Compilation Technology © 2003 IBM Corporation 14CGO Code Size Results Lower is better

Compilation Technology © 2003 IBM Corporation 15CGO Summary  Real-time applications need determinism  Java not traditionally suitable for RT systems –RTSJ plus new technologies like Metronome GC and Ahead-Of-Time compilation making it possible  Deterministic performance has overheads –Many sources (RTSJ, Metronome, disabled opts)  NHRT checks should be implemented in snippets –Recovers some perf overhead without growing code size astronomically

Compilation Technology © 2003 IBM Corporation 16CGO Got Questions? Mark Stoodley IBM Toronto Lab

Compilation Technology © 2003 IBM Corporation 17CGO Backup slides

Compilation Technology © 2003 IBM Corporation 18CGO Grand Challenge: Transparent Real-time Java C++ Application C++ Runtime System Manual, Unsafe Predictable Java Application Java Runtime System (JVM) Garbage Collection Automatic, Safe Unpredictable Java Application Metronome Java Runtime System Automatic, Safe Predictable

Compilation Technology © 2003 IBM Corporation 19CGO WRT Architecture Java jar J9 VM Real-time GC Metronome Java SE 5.0 Libraries Real-time feature (“-Xrealtime”)Standard J9 component X86-32 Opteron (4-way SMP) Real-time Linux (Based on RedHat 4.2) Bind Bound jar Compile Real-time JIT Real-time library

Compilation Technology © 2003 IBM Corporation 20CGO The Easy Stuff  Disable speculative optimizations  Lower priority of JIT compiler –Below priority of any real-time activity –But higher than any non-real-time activity  Sampling thread still has very high priority –Does very little work so impact is not high  Suitable for “softer” real-time environments with “looser” timing requirements

Compilation Technology © 2003 IBM Corporation 21CGO When JIT effects cannot be tolerated  Ahead-Of-Time compilation technology  Generate native code statically –Throw away platform neutrality –No compilation or sampling thread active at runtime  Java conformance has a performance cost –All references unresolved –Optimizer largely hamstrung (but not always)

Compilation Technology © 2003 IBM Corporation 22CGO Real-Time Linux  Customized kernel, fully open-source  Fully preemptible kernel  Threaded interrupt handlers for reduced latency  SMP real-time scheduling  High resolution timers  Priority inheritance support to avoid inversion  Robust and fast user-space mutex support