J2ME: Design, Performance and Efficiency With WSDD Randy Faust Embedded Java Activist IBM OTI Labs Phoenix IBM OTI Labs Zürich.

Slides:



Advertisements
Similar presentations
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Advertisements

Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007.
Extending Eclipse CDT for Remote Target Debugging Thomas Fletcher Director, Automotive Engineering Services QNX Software Systems.
©2003 aQute, All Rights Reserved Tokyo, August 2003 : 1 OSGi Service Platform Tokyo August 28, 2003 Peter Kriens CEO aQute, OSGi Fellow
Starting With The OSGi Specifications By Peter Kriens, CEO aQute OSGi Fellow
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
6 Copyright © 2005, Oracle. All rights reserved. Building Applications with Oracle JDeveloper 10g.
1 Data Link Protocols By Erik Reeber. 2 Goals Use SPIN to model-check successively more complex protocols Using the protocols in Tannenbaums 3 rd Edition.
Homework Reading Machine Projects Labs
In Production Juan Marin. Agenda Introduction Reliability Availability Performance Data optimizations Runtime optimizations Measuring your environment.
Configuration management
Debugging operating systems with time-traveling virtual machines Sam King George Dunlap Peter Chen CoVirt Project, University of Michigan.
INTRODUCTION TO SIMULATION WITH OMNET++ José Daniel García Sánchez ARCOS Group – University Carlos III of Madrid.
Paging: Design Issues. Readings r Silbershatz et al: ,
Trap Diagnostic Facility Todays Software Diagnostic Tool with innovative features for the z/OS software developer Arney Computer Systems.
4 Oracle Data Integrator First Project – Simple Transformations: One source, one target 3-1.
IBM JIT Compilation Technology AOT Compilation in a Dynamic Environment for Startup Time Improvement Kenneth Ma Marius Pirvu Oct. 30, 2008.
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Process An operating system executes a variety of programs: Batch system.
Processes Management.
MHK200 Module 1: Introduction to Windows CE. MHK200 Overivew Windows CE Design Goals Windows CE Architecture Supported Technologies, Libraries, and Tools.
1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
Overview Motivations Basic static and dynamic optimization methods ADAPT Dynamo.
9.0 EMBEDDED SOFTWARE DEVELOPMENT TOOLS 9.1 Introduction Application programs are typically developed, compiled, and run on host system Embedded programs.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 10 Java for MIDs Rob Pooley
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Aarhus University, 2005Esmertec AG1 Implementing Object-Oriented Virtual Machines Lars Bak & Kasper Lund Esmertec AG
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
Embedded Java Research Geoffrey Beers Peter Jantz December 18, 2001.
Cisco IOS & Router Config Semester 2V2 Chapter 6.
P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Compilers, Interpreters and Debuggers Ruibin Bai (Room AB326) Division of Computer Science.
Tutorial 11 Installing, Updating, and Configuring Software
So just what is the Sedona Framework? –The Framework is an embedded device programming and control environment with two major facets –Open Source Free.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Bill Au CBS Interactive Troubleshooting Slow or Hung Java Applications.
Bill Au CBS Interactive Troubleshooting Slow or Hung Java Applications.
Java 2 Micro Edition (J2ME) and the world of java
Android for Java Developers Denver Java Users Group Jan 11, Mike
BLU-ICE and the Distributed Control System Constraints for Software Development Strategies Timothy M. McPhillips Stanford Synchrotron Radiation Laboratory.
Chapter 3.5 Memory and I/O Systems. 2 Memory Management Memory problems are one of the leading causes of bugs in programs (60-80%) MUCH worse in languages.
Buffered dynamic run-time profiling of arbitrary data for Virtual Machines which employ interpreter and Just-In-Time (JIT) compiler Compiler workshop ’08.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 7 OS System Structure.
Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.
3.1 Operating System Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
Msdevcon.ru#msdevcon. ИЗ ПЕРВЫХ РУК: ДИАГНОСТИКА ПРИЛОЖЕНИЙ С ПОМОЩЮ ИНСТРУМЕНТОВ VISUAL STUDIO 2012 MAXIM GOLDIN Senior Developer, Microsoft.
Duke CPS Java: make it run, make it right, make it fast (see Byte, May 1998, for more details) l “Java isn’t fast enough for ‘real’ applications”
Nguyen Thi Thanh Nha HMCL by Roelof Kemp, Nicholas Palmer, Thilo Kielmann, and Henri Bal MOBICASE 2010, LNICST 2012 Cuckoo: A Computation Offloading Framework.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Copyright (c) JNode.org g JNode a modern Java operating system JNode.org Ewout Prangsma.
© 2002, Cisco Systems, Inc. All rights reserved.
Chapter 2: System Structures
Introduction Enosis Learning.
Java Virtual Machine Complete subject details are available at:
CMPE419 Mobile Application Development
Introduction Enosis Learning.
Chapter 3: Operating-System Structures
9.0 EMBEDDED SOFTWARE DEVELOPMENT TOOLS
Chapter 2: Operating-System Structures
Outline Chapter 2 (cont) OS Design OS structure
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
System calls….. C-program->POSIX call
Chapter 2: Operating-System Structures
CMPE419 Mobile Application Development
Chapter 13: I/O Systems.
Overview of System Development for Windows CE.NET
JIT Compiler Design Maxine Virtual Machine Dhwani Pandya
Presentation transcript:

J2ME: Design, Performance and Efficiency With WSDD Randy Faust Embedded Java Activist IBM OTI Labs Phoenix IBM OTI Labs Zürich

2 Past, Present, and (near) Future. Whats happened so far? Why have people failed? Where do we go from here? What to consider. Best practices. Tools and Tuning. Questions?

3 Whats Happened So Far. False starts: Personal Java, Embedded Java, Micro Java, Pico Java IBM builds J9. IBM invents custom class libraries: Extreme, Core, Max IBM is on its 9th embedded Java release: VAES 1.0, VAME , WSDD J2ME is created: Configurations, profiles, WME, WCE Java powered and TCK

4 Why Have People Failed? Not enough hardware. 5 developers == 5 boards Little or No in field development. Not enough testing throughout the project lifecycle. Failing to appreciate system constraints. Embedded guys trying to do Java. Java guys trying to do embedded.

5 Why Have People Failed? Having insufficient knowledge of the OS. Believing WORA in the embedded space. Trying to extend the good-enough approach. Creating too many threads. Forgetting that Java heap isnt the only memory required. The VM is an application which also uses memory. How much can depend a good deal on how many classes you load.

6 Where Do We Go From Here? Greatest use of Java in the embedded space. More and better choices for embedded graphics. Faster VMs. Faster chips, cheaper memory, lower power. Plugins for WSDD from Eclipse or WSWB enabled 3 rd parties.

7 What to consider. OS, Processor, Tools (self hosted or X-compiled, debugger) Hardware configuration memory, processor speed, interfaces (serial, ethernet, MOST, flash) Java feature set Class libs, Frameworks, UI, big Int, zip support, compressed zips, verification, one-shot or command-line, JIT, AOT Development cycle turn-around time time = generate + build + download + run Available documentation and support

8 Best Practices (This is all a lie) Choose the right parts to code in Java. Device drivers are usually not good candidates. Beware Vector. Fastest is ArrayList, although its unsynchronized. Stack just extends Vector. Be smart about GCs. Tune the app, and ask for GCs yourself. Reuse existing objects. Take the effort to reinitialize their values. Take into account the connectivity of your platform. Dont forget the background traffic use cases. Know the fastest possible startup time, before you run a single line of code.

9 Best Practices (This is also a lie) Avoid method calls as loop termination criteria. for (int i= 0; i < str.length(); i++) Avoid synchronization JIT may be able to remove sync blocks, but dont count on it Avoid monster objects. Avoid finally() blocks. Avoid String concatenation. Use StringBuffer objects instead.

10 Best Practices (Yet more lies) The amount of code is bytecodes, not the size of your source. Message sends are costly. In-line small methods, getters/setters, use JIT in-lining. Always ask yourself, Does this make sense? Is it easy to understand? Could we make it simpler? Bigger methods take a longer time to inline and cost more memory. Small methods JIT faster, but large methods give you more value when theyre JITted. Dont optimize too early. Optimizing 5% usually yields most of the potential improvement. Use Lazy Initialization.

11 Best Practices (Some truth here) Erase code. Manage your resources carefully. Version control your use cases and requirements. Hard writing makes for easy reading. The easiest way is probably the best way. Save time for certification. Objects die young.

12 Tools and Tuning: The J9 VM Bottom-up design, Cleanroom JDK 1.3 compliant Fast interpreter written in assembler using register based calling convention Multi-VM, JVMP, JDWP, INL Pluggable class libraries Mixed-mode execution: AOT/JIT/interpreter New GC: accurate, incremental, compacting Statically or dynamically linked Native threads, widgets and memory management Thin port layer to isolate use of OS

13 Tools and Tuning: Configuring the VM Three configuration levels: At runtime using command options –changing default memory settings or garbage collector characteristics –JIT At integration time by selecting the desired set of modules –removing shared objects (math, dbg, zip, jxe, etc.) At build time by changing the VM-OS code or Application code –Jxe –AOT –changing the thread model or scheduler

14 Tools and Tuning: Jxes Java Executable. Split representation of Java classes WHY? Organized more thoroughly than.class files. Future: JSR-202? Reduces memory footprint Faster execution as class loading time is reduced Allows sharing of class libraries, user code –Multi-VM size reductions for servers and handheld No file system or network required Allows Execution in Place (XIP) from Flash Classes loaded on demand, not all at once

15 Tools and Tuning: VM Memory Tuning -Xmca Set RAM class segment increment to -Xmco Set ROM class segment increment to -Xmx Set memory maximum to

16 Tools and Tuning: The Garbage Collector -Xmn Set new space size to -Xms, -Xmo Set old space size to -Xmoi Set old space increment to -Xmx Set maximum memory to -Xmr Set remembered set size to

17 Tools and Tuning: JIT and AOT JIT compiled code is better than AOT compiled code because it will use runtime profiling information. AOT is typically more useful when you have prior information about the runtime characteristics of the application. Adaptive recompilation is possible on certain platforms. Code is never un-JITed. Theres almost never a reason for this. AOT and JIT can be mixed in jxe files.

18 Tools and Tuning: JIT and AOT Use a limit file after profiling when you know what you want to JIT. Big methods take a longer time to compile or inline and will use more memory. High optimization level of JIT are often best left for benchmarks. X-compiler for x86. Dumptrucks only go a little faster with turbo.

19 Tools and Tuning: Smartlinker Preprocesses Java classes into target executable form (jxe) Splits code into RAM/ROM format Reduces code by removing unused classes, methods, fields Creates jxe file in target platform endian and addressing Supports XIP by prelocating jxe for ROM addressing

20 Tools and Tuning: Smartlinker Package jxe with preverification info Precompile methods Segment the jxe Obfuscate method and class names Specify the startup class if applicable Create component jxes

21 Tools and Tuning: MicroAnalyzer Capture and timestamp key events with low overhead ~5% Target or Workstation triggering and tracing options Measure time between user events Measure memory usage See context switch events between threads

22 Tools and Tuning: Remote Debugging Implements JDWP wire protocol, including hot code replace Runs over a proxy to save space on the target -verbose class, jni, gc, dynload, stack, debug -memorycheck –all: Lots of checking, slow –quick: Minimal checking, fairly fast –nofree: Dont free any of the memory –failat= X:Fail allocation X –skipto= X:Only start memory checking at X Use a friendlier platform

23 Questions?