May 17, 2015
1
2
<Insert Picture Here>
Java for Embedded Devices
Ben Pashkoff ([email protected])Principle Sales Consultant(Based on presentations by Greg Bollella and Robert Vandette)
3
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
4
One Additional Caveat
Material in this presentation is subject to change with no prior notification based on any announcements or changes that may be communicated by Oracle Corporation at Oracle OpenWorld, Oracle Develop or Oracle Java One.
5
<Insert Picture Here>
Program Agenda
• What is Java Embedded• ME Embedded Background• SE Embedded Background• Oracle Java for Embedded Solutions
Overview• Trends, Futures• Resources• Q & A• Demonstrations (Time Permitting)
6
Quiz time!!WHO is the “Father” of Java?
A
B
C
D
E
7
Java Metrics
• 5 billion Java Cards in use• 3 billion Java-based handsets• 850+ million Java desktops• 90+ million Java-based TV devices• All Blu-ray disc players ship with Java• Many more embedded devices with Java everywhere
8
What comprises a “complete” embedded system?
InputOutput ComputeOS Programming Model Programming Tools
9
Trends in Embedded Systems Design
• Larger code bases• More complex code• More function• Faster development cyles• Connection to Internet• Connection to OEM HQ• BOM costs *still* crucial• More HW features
10
Embedded Microprocessor Trends
• Embedded Multi-Core is everywhere• ARM continuing low power legacy, Intel moving into that space
with Atom• ARM setting sights on server market
• Cortex A5 Dual Core
• Cortex A9 Dual/Quad Core
• 250mw power 1ghz today
•ARM Eagle Cortex A15 Coming
• Quad 2.5 ghz!
• Nvidia Tegra 2 – 1ghz Dual A9
• Marvell Quad-Core
•TI OMAP4 Dual core Cortex-A9
Common Themes
• PowerPC QorIQ Family
• P2020 Dual Core 1.2ghz
• P4080 Quad Core 1.5ghz
Embedded Communication
Processors
• Atom Dual Core Processors
• N550 1.5ghz 8.5w
• D525 1.8ghz 13w
• D510 1.66ghz 13w
• 330 1.6ghz 8w
11
Java Features • Proven & Stable• Huge Developer Base• Rapid Application Development• Fully Object Oriented• Run on a Virtual Machine
– Memory Management, Portability, Cross Platform …• Multi-Thread, -Process and -CPU/Core support• Security• Networking• Deployment
12
Java: The Best Platform for Embedded Applications
Decouples software development from hardware development cycle
Development and testing can be done (mostly) using standard desktop systems
Highly productive language, APIs, runtime, and tools mean quick time to market
Create high-performance, portable, secure, robust, cross-platform applications easily
Java isolates your apps from language and platform variations (e.g. C/C++, kernel, libcdifferences)
1
2
3
6
7
8
9
Most popular embedded processors supported allowing design flexibility
Support for key embedded features (low footprint, power mgmt., low latency, etc)
Leverage huge Java developer ecosystem (expertise, existing code)
Easily create end-to-end solutions integrated with Java back-end services
Solutions from constrained devices to server-class systems
4
5 10
13
Paradigm shift
Before: Embedded = Java METargeted at small devices (~32MB or less)Handheld devices: PDAs, cell phones, etc.Other small consumer devices too: set top boxes, gaming devices, etc.
Now: Embedded = Java ME and Java SETargeted at larger devices (~32MB or more)POS terminals, ATMs, medical/laboratory devices, transportation devices, building automation devices, industrial automation devices, etc.
Embedded Java perception
14
“Traditional” Java Embedded Marketplace
Java Card Java ME(CLDC) Java ME(CDC) Java SE Java EE
Traditionally Java is Embedded here:Traditionally Java is Embedded here:
15
Oracle Java Platforms
15©2010 Oracle Corporation
TVTVDesktopsDesktops MobileMobile CardsCardsServersServers
Java Language
Java EE
VMs
APIs
EmbeddedEmbedded
Java SE Java TV Java CardJava ME
Server Client TV CardMobile
BD-J
16
Current Deployment Landscape
16
17
Java in Embedded –Java SE Embedded
18
What does “Embedded” mean?• Two definitions used: Legal and Technical
• Legal definition of Embedded SE:Designates a Field Of Use (FOU)
– Embedded FOU defined in the license file as anything that is not a “general purpose desktop computer or server”
• e.g : “industrial control systems, wireless mobile telephones, wireless handheld devices, kiosks, TV/STB, Blu-ray Disc devices, ATM's etc...”
– Applies to both embedded (footprint-reduced) SEimplementations and “regular” SE implementations
– Royalty bearing, affordable pricing
• Dedicated, flexible, versatile pricing model applies:based on unit cost and volume.
19
Java SE Embedded Only Implementation
Embedded Only Features:− Memory reductions/optimizations− Disk/Flash/ROM size reductions Headless Configuration Removal of optional files and Java classes
− Low Power Handling− Additional Platforms (Linux/ARM, Linux/Power, WinXP
Embedded)
And of course all the good stuff Java SE brings out of the box and via third party libraries/apps … (like Java EE ...)
20
Targeted Configurations(Today)
Processor OperatingSystem
Headless orHeadful
FPU Java SE Version
ARMv5 Linux Headless Soft-Float 6U21
ARMv6/v7 Linux Headless & Headfull (v7)
Hard-Float 6U21
PowerPCe600 core
Linux Headless Classic Hard-Float
6U21
PowerPCe500v2 core
Linux Headless Embedded Hard-Float
6U21
21
Java in Embedded –Tech Stuff
22
Small Footprint for Embedded
The standard release’s ROM/disk footprintis too big for many embedded devices
− Memory getting cheaper, but cost remainsa factor: Profit = Margin x Volume
Small footprint optimizations− Additional Compression, File Removal− Footprint reduction of up to 56% e.g 6.0 for ARM around 32 MB e.g., for 5.0 on Linux/x86: from 68MB to 29.5MB
23
Java SE – Custom Embedded Builds
• Technical definition of embedded SE:Custom – footprint-reduced – but still SE
compatible
SEspecification
NOT an SEimplementation
“Regular” SEimplementation
Embedded SEimplementation
optionalcomponents
24
Small Footprint for Embedded
File removal includes Deployment: Java Web Start, Plug-in, Pack2000and Unpack2000 IDL and RMI: rmiregistery, rmid, servertool,tnameserv Security: Policytool, keytool, ktab, klist, kinit Orbd Man pages Localization
− Character convertors (charsets.jar) Remove either Client Compiler or Server Compiler
25
Headless Feature for SE Embedded
Headless option− No support for keyboard, mouse, video− Otherwise full SE functionality, including printing
Runtime and build implementation− Headless flag hard-wired on Djava.awt.headless=true
− “Headful” files removed, including libmawt.so
26
Tuning your Embedded Java Solution Default configuration Improving Startup Time Taking Advantage of Multi-core processors Picking the Right Garbage Collector
Heap Size
Memory Consumption
Startup Time
Disk/Flash Consumption
JIT Strategy
Garbage Collection Policy
Throughput/Response Time
Clock Speed, Number of CPUs?
27
Low Memory Support
The Linux community has been searching for solutions to handle low memory conditions
Killing processes is NOT the answer (SIGABORT, ouch!)
We chose to support /dev/mem_notify− Linux kernel driver monitoring available memory
/dev/mem_notify avail?
CreateMonitoring
Thread
Open /dev/mem
notify
YES
NO
Feature Unavailable
Block Waitingfor Input
from Device
Full GC
*Release AdditionalVM Memory
(JIT Buffers, etc)
28
Java SE Embedded FeaturePower Conservation
• Goal– Reduce CPU usage to 0% when Java
applications are idle in order to allow CPU clock to be reduced or suspended
• Modifications Performed– Hotspot Virtual Machine
• Eliminated all Polling Threads– Java SE AWT/Swing Changes
• Eliminated Polling for X Events when idle
28
29
Java SE Embedded Design Focus
• Assumptions leading to our default configuration of SE Embedded
– Most embedded devices are resource constrained– Keeping per unit device cost low is high priority– Use lower clocked processors
Option Java SE Embedded Default State
Performance Monitoring Off by Default
Compression of JAR Files All Jar File Compressed
All JRE Files Included Optional Files Removed
30
Improving Startup Time
Class Data Sharing (If classloading is bottleneck)− Enabling Class Data Sharing− Customizing Class Data Sharing Archive− Can improve Startup by 25%-30%
Uncompressing jar files (If disk space is available)− Gain is dependent on disk access and CPU clock speed
Lower Compilation Threshold (If MP device)-XX:CompilationThreshold=xxxx (default is 1500)
Deferring Initialization or Class Loading in your application
31
Enabling and Configuring Class Data Sharing
Enabling CDS with default classlist− java –Xshare:dump− Once complete, CDS is automatically enabled
Use java –Xshare:on OR –Xshare:off to compare startup times.
The default classlist is for GUI Swing Based Apps
32
Customizing Class Data Sharing for Embedded Java Applications
1. Create a list of classes loaded at the startup of your applicationjava –Xshare:off –XX:+TraceClassLoadingPreorder {your app} >my_class_list*exit your app soon after startup
2. Extract only bootclass loaded classes. Outputs classlist.linux.java MakeClassList my_class_list >new_classlist
3. Add checksum to end of new_classlistjava AddJsum new_classlist classlist
4. Copy classlist to {JRE}/lib directory5. Create classes.jsa file
java –Xshare:dump– You now have a customized classes.jsa file!
Tools referenced on this page can be found in openjdk sources here: jdk/make/tools/src/build/tools
33
Taking Advantage of Multi-Core Processors with Java
Built in VM Features that take advantage of SMP− Parallel Garbage Collection− Concurrent Garbage Collection− Background JIT Compilation
Lower Compilation Threshold
Parallelize your Java Application Code
34
Which Garbage Collector Should I Use?Java SE Embedded Contains all of the standard collectors
For more details on GC tuning options see:
http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html
Collector Option Pro Con MP
Serial -XX:+UseSerialGC(default)
Best Choice for single CPU
N
Concurrent -XX:+UseConcMarkSweepGC-XX:+CMSIncrementalMode
Better if response time is highest priorityShorter GC pauses
Uses processor resources while embedded app is running
Y
Parallel (Young)
Parallel (Old)
-XX:+UseParallelGC
-XX:+UseParallelOldGC
Better if throughput is highest priority.Uses multiple processors to speed up GC collection
GC must still pause embedded app during collections.
Y
35
Reducing System Resource Requirements(Reducing Memory Consumption)
Customizing Heap Sizes-Xms -Xmx
Adjust Free Ratios-XX:MaxHeapFreeRatio=xx (control heap reduction, default 70)
-XX:MinHeapFreeRatio=xx (controls heap expansion, default 40)Reducing JIT CodeBuffer
-XX:ReservedCodeCacheSize=xxMStandard Java SE tools can be used to identify potential memory savings
− Use jvisualvm with Linux x86 JDK Heapdump option
36
Java in Embedded –Market Stuff
37
SE for Embedded Product OverviewTwo groups of product offerings
• For Desktops/Servers AND Embedded– Standard Releases and Platforms: x86, x64, Sparc® (32 and 64 bit) Linux, Windows, Solaris–On the web, regular updates
• For Embedded ONLY– Additional platforms: ARM, PowerPC, XP-Embedded– Additional features: Headless/Small Footprint, Memory Optimizations, Low Memory Handling, Power Savings– On the web, transitioning to regular updates
• Wide range of platforms supported (30+ ISA/OS sets)• Development is free
• Deployment requires commercial licensing
38
Target Market Data – SE for EmbeddedData Highlights from Surveys (till 12/10)
Industry Sampling:•Motorola
•Lockheed Martin
•Ricoh
•Cisco
•Alcatel-Lucent
Educational Sampling:Stanford University
Carnegie Mellon University
John Hopkins University
Rochester Institute of Technology
Pennsylvania State University
% Evals Java SE-Embedded by Geo
EMEAAMER
% Evals Java SE-Embedded by Org
Company
39
Current Java SE Embedded OfferingsSE 6u21 – latest release available on web Nov 1, 2010
Processor Operating System
Headless orHeadful
FPU Java SE Version
ARMv5 Linux Headless SFLT 6u21
ARMv6/v7 Linux Headless &Headful (v7)
VFP 6u21
PowerPC E600 core
Linux Headless Classic HW FP 6u21
PowerPC e500v2 Linux Headless Embedded FP 6u21
x86 Linux Headless X86 6u21
* All configurations dynamically detect and support single or multi-core processors
40
Java SE for Embedded 6u21 Release
•Sync most popular Java embedded platforms with latest SE release• ARM release from: 6u10 to 6u21• X86 (Small Footprint) & PowerPC from: 5u10 to 6u21
•Rich set of features and APIs of 6u21 and the hundreds of enhancements, security improvements and bug fixes now available to embedded
•Allows developers to deploy on their embedded device the same Java SE version they develop with on their PC.
•Integrated embedded code with SE sources•Enables staying in sync with standard SE
41
Java SE for Embedded 6u21 Release
• Expanded Multi-Core Support•Added multi-core support for ARM and PowerPC•Multi-core features of Java SE such as parallel GC, background JIT compilation are now available for growing use of multi-core systems in embedded
• Additional Platform Support•Added support for PowerPC e500v2
• Improved Performance/Benchmarks
• SPECjvm98 improvements• ARM: 10%; PowerPC: 19%; x86: 17%
• ~20% improvement in CaffeineMark on all SE-E 6u21• ~2x the performance of Android on common benchmarks
42
Embedded CaffeineMark Performance Improvements
+29%
+22%
+21%
43
specJVM98 Performance Improvements
+19%
+17%
44
2.17X
2.6X 1.53X
2.15X
Beagleboard Specs
TI OMAP3530 CPU
Cortex-A8
256MB RAM
600Mhz
* Chart is displaying relative performance differences only. Scores have been proportionately scaled to fit on chart.
45
2.5X
3.2X 2X
* Chart is displaying relative performance differences only. Scores have been proportionately scaled to fit on chart.
Tegra-2 Specs
ARM Cortex-A9 Dual-Core CPU
1GB RAM
1GHZ
46
SE Embedded Future
•Track SE releases closely• SE 7 Highlights
• JSR 292 –InvokeDynamic, Project Coin (small language changes)• SE 8 Highlights
• End-2012, Project Lambda – Closures, Modularity• Performance, startup and size reduction always top priority
•C2 for ARM• Bundled solutions for specific markets e.g.-
• Berkeley DataBase, Sync Agent, Mobile Client
47Oracle Internal and Restricted10/26/10 47
Java Embedded – ME & SEItem SE Embedded
CDC Spec compliance Available with proven deployment
MIPS support Available with proven deployment
Special Embedded Features
Available Upper Stack PBP/AGUI, MIDP/MSA, OSGi, JavaTV, GEM All SE packages
Static Foot Print (headless) 4MB/7.5MB 32MBRuntime requirement Typically 8MB to 64MB
Startup Time Cold <300ms, Warm <100-200ms Slower
OS Portability
CPU Portability (w/JIT) ARM, x86, PowerPC, Sparc
Graphics portability X11, Windows
Latest language and API SE 1.6
CDC HI 1.1.2/CDC HI 1.6
Technically possible, roadmap not defined
Romization, AOT, Dual Stack, MVM, designed/implemented to be memory efficient
headless, memory optimizations, multiple GC collectors, in process MVM.
headless:32MB headful: 64MB to 128MB
Linux, WinCE, Brew, Symbian, pSOS, VxWorks, OS20, Win32, Solaris, Mac OS X
Linux, XP Embedded, Linux GC, Windows, Solaris, NetBSD, QNX
ARM, MIPS, X86, PowerPC, Sparc, MIPS, AM34, ST20, SH3/4, ARC
DirectFB, DirectX, MPE, PFC, MicroWindows, QT, etcSubset of 1.4.2/Subset of 1.6 (planned)
48Oracle Internal and Restricted10/26/10 48
API PackageSE 1.6/1.7 CDC/FP 1.1.2 CDC/FP 1.6
java.applet Yes no nojava.awt Yes no nojava.beans Yes no nojava.io Yes Subset Yesjava.lang Yes Subset Yesjava.math Yes Subset Yesjava.net Yes Yes Yesjava.nio Yes no Yesjava.rmi Yes no nojava.security Yes Subset Yesjava.sql Yes no nojava.text Yes Yes Yesjava.util Yes Subset Yesjava.util.concurrent Yes no Yesjava.util.logging Yes no Subsetjava.util.pref Yes no nojava.crypto Yes Yes Yesjavax.security Yes Subset SubsetJavax.* (~70 other packages) Yes no noorg.* Yes no noomg.org.* Yes no noStatic footprint (with SecOP) 32 MB 4 MB 7.5 MB
Embedded SE
49
Another Quiz!What famous CEO played in Iron Man 2
(and looks like Robert Downey Jr.)?
A
B
C
50
Java SE Embedded Examples in the Field
51
Java SE for EmbeddedExample devices
• ATMs• Parking Meters• POS Systems
• Lottery/Gaming Systems• Multi Function Printers
• Intelligent Power Module• Netbooks
• Routers & Switches• Storage Appliances
• Network Management Systems• Medical Imaging Systems
• Radar Systems• Industrial PCs
• Factory Automation Systems• Geo-Imaging Devices
• Smart Meters• RFID Readers
• Video Conferencing Systems
• In-Flight Entertainment Systems
• Video Streaming Systems• Electronic Voting Systems• Voice Messaging Systems
• Security Systems
52
Java SE Embedded in Smart Metering
EnergyICT
Java SE Embedded Based
Smart Meter Concentrator
53
Special Bonus!
Tips for getting started with Java Se Embedded
54
Getting Started• Purchase Embedded Device
• Many low cost ARM single and multi-core devices• Single Core ARM Cortex-A8 devices
• SheevaPlug ($99) http://www.plugcomputer.org• BeagleBoard ($149) http://beagleboard.org
• Multi-Core ARM Cortex-A9 devices• PandaBoard ($174)http://pandaboard.org• Nvidia Tegra 250 Developer Kit ($399)
http://developer.nvidia.com/tegra/tegra-devkit-features• You’ll need USB Keyboard, Mouse and HDMI Video monitor• Download / Install / Setup Linux Distribution
• Some vendors provide pre-installed ready-to-go Linux distros. Special Computing does this for Beagleboard and Pandaboard http://specialcomp.com
• Download and un-tar Java SE Embedded• http://oracle.com/technetwork/java/embedded
55
Sample Embedded ARM DevicesBeagleboard
http://beagleboard.orgPlug computer
http://www.plugcomputer.orgPandaboard
http://pandaboard.org
Beagleboard Specs
TI OMAP3530 CPU
Cortex-A8
256MB RAM
600Mhz
Pandaboard Specs
TI OMAP4430 CPU
Dual Core Cortex-A9
1GB RAM
1Ghz
Plug Computer Specs
Marvell ARMv5 CPU
512MB RAM
1.2ghz
56
Java SE Embedded Platform ExampleGuruPlug
Low Power ARM/Linux based device design by Maxwell 512 MB RAM, 512 MB Flash, USB & Gigabit Ethernet Approx $100-120 for single devices Flexible and Capable Runs Java SE Arm v5/Linux headless Low Power Java Web Server:
http://www.theregister.co.uk/2010/11/11/diy_zero_energy_home_server/
57
Wrapping up
58
Java: Features
• Proven & Stable• Huge Developer Base• Rapid Application Development• Fully Object Oriented• Runs on a Virtual Machine• Multi-Thread, -Process and -CPU/Core support• Security• Networking
59
Embedded Systems Conference
• May, 2011, San Jose• Embedded Java Hands On Lab
• Expect 30+ attendees• GuruPlug + USB temperature sensor (one per attendee)• Verrazano Development Environment• 90 minutes• Students will download Embedded SE BDB, and sync agent, install them on GuruPlug• 3 exercises
• Hello World• Periodically reading a temperature sensor• Save temp values into local BDB see them on Oracle DB on instructors laptop
60
Resources• Oracle Embedded Java Products
• oracle.com/us/technologies/embedded/embeddable-java-185427.html
• Embedded Java Overview• oracle.com/technetwork/java/embedded/overview/index.html
• Java ME Home• oracle.com/technetwork/java/javame/overview/index.html
• Blogs and News• blogs.oracle.com/java• terrencebarr.wordpress.com
• The Java Spotlight Podcast• thejavaspotlight.org
• Follow @Java on Twitter
61
<Insert Picture Here>
Questions?
For more information on Java Embedded:www.oracle.com/technetwork/java/embedded
Or write me at:
Ben Pashkoff ([email protected])
62
Which of the following do YOU think of
when you think of Java?
A
B
C
D
EF
G
63
64
Appendix<Insert Picture Here>
65
Java Everywhere
66
The Spectrum of Java
Servers Desktop Embedded TV Mobile Card
Java Language
Java SE Java ME Java Card
Java EE Java TV
BD-J
JavaFX MSA
67
Section Divider