2. <Insert Picture
Here>
Java for Embedded Devices
Ben Pashkoff (benjamin.pashkoff@oracle.com)
Principle Sales Consultant
(Based on presentations by Greg Bollella and Robert Vandette)
2
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.
3
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.
4
5. Program Agenda
• What is Java Embedded <Insert Picture Here>
• ME Embedded Background
• SE Embedded Background
• Oracle Java for Embedded Solutions
Overview
• Trends, Futures
• Resources
• Q&A
• Demonstrations (Time Permitting)
5
6. Quiz time!!
WHO is the “Father” of Java?
C
A
B
E
D
6
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
7
8. What comprises a “complete”
embedded system?
Input
Output
Compute
OS
Programming Model
Programming Tools
8
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
9
10. Embedded Microprocessor Trends
• Cortex A5 Dual Core • Atom Dual Core Processors • PowerPC QorIQ Family
• Cortex A9 Dual/Quad Core • N550 1.5ghz 8.5w • P2020 Dual Core 1.2ghz
• 250mw power 1ghz today
• D525 1.8ghz 13w • P4080 Quad Core 1.5ghz
•ARM Eagle Cortex A15 Coming
• D510 1.66ghz 13w Embedded Communication
• Quad 2.5 ghz!
• 330 1.6ghz 8w Processors
• Nvidia Tegra 2 – 1ghz Dual A9
• Marvell Quad-Core
•TI OMAP4 Dual core Cortex-A9
Common
Themes
• Embedded Multi-Core is everywhere
• ARM continuing low power legacy, Intel moving into that space
with Atom
• ARM setting sights on server market
10
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
11
12. Java: The Best Platform for Embedded
Applications
Decouples software development from Most popular embedded processors
1 hardware development cycle 6 supported allowing design flexibility
Development and testing can be done Support for key embedded features (low
2 (mostly) using standard desktop systems
7 footprint, power mgmt., low latency, etc)
Highly productive language, APIs, runtime, Leverage huge Java developer
3 and tools mean quick time to market
8 ecosystem (expertise, existing code)
Create high-performance, portable, secure, Easily create end-to-end solutions
4 9 integrated with Java back-end services
robust, cross-platform applications easily
Java isolates your apps from language and Solutions from constrained devices to
5 10 server-class systems
platform variations (e.g. C/C++, kernel, libc
differences)
12
13. Paradigm shift
Embedded Java perception
Before: Embedded = Java ME
Targeted 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 SE
Targeted at larger devices (~32MB or more)
POS terminals, ATMs, medical/laboratory devices, transportation devices,
building automation devices, industrial automation devices, etc.
13
14. “Traditional” Java Embedded
Marketplace
Traditionally Java is Embedded here:
Java Card Java ME(CLDC) Java ME(CDC) Java SE Java EE
14
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) SE
implementations and “regular” SE implementations
– Royalty bearing, affordable pricing
• Dedicated, flexible, versatile pricing model applies:
based on unit cost and volume.
18
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 ...)
19
20. Targeted Configurations
(Today)
Processor Operating Headless or FPU Java SE
System Headful Version
ARMv5 Linux Headless Soft-Float 6U21
ARMv6/v7 Linux Headless & Hard-Float 6U21
Headfull (v7)
PowerPC Linux Headless Classic Hard- 6U21
e600 core Float
PowerPC Linux Headless Embedded 6U21
e500v2 core Hard-Float
20
22. Small Footprint for Embedded
The standard release’s ROM/disk footprint
is too big for many embedded devices
− Memory getting cheaper, but cost remains
a 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
22
23. Java SE – Custom Embedded Builds
• Technical definition of embedded SE:
Custom – footprint-reduced – but still SE
compatible
SE
specification
“Regular” SE
implementation
Embedded SE
implementation
optional
NOT an SE components
implementation
23
24. Small Footprint for Embedded
File removal includes
Deployment: Java Web Start, Plug-in, Pack2000
and 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
24
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
25
26. Tuning your Embedded Java Solution
Default configuration
Improving Startup Time
Taking Advantage of Multi-core processors
Picking the Right Garbage Collector
Throughput/Response Time
Disk/Flash Consumption Memory Consumption
Clock Speed, Number of CPUs Heap Size
?
JIT Strategy Startup Time
Garbage Collection Policy
26
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
Create Block Waiting
/dev/me YES Open for Input
m_notif Monitoring /dev/mem
y avail? Thread notify from Device
NO
Full GC
Feature
Unavailable *Release Additional
VM Memory
(JIT Buffers, etc)
27
28. Java SE Embedded Feature
Power 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
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
29
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
30
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
31
32. Customizing Class Data Sharing for
Embedded Java Applications
1. Create a list of classes loaded at the startup of your application
java –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_classlist
java AddJsum new_classlist classlist
4. Copy classlist to {JRE}/lib directory
5. 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
32
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
33
34. Which Garbage Collector Should I Use?
Java SE Embedded Contains all of the standard collectors
Collector Option Pro Con MP
Serial -XX:+UseSerialGC Best Choice for single N
(default) CPU
Concurrent -XX:+UseConcMarkSweepGC Better if response time is Uses processor resources Y
-XX:+CMSIncrementalMode highest priority while embedded app is
Shorter GC pauses running
Parallel (Young) -XX:+UseParallelGC Better if throughput is GC must still pause Y
highest priority. embedded app during
Parallel (Old) -XX:+UseParallelOldGCdetails on GC tuning options see:
For more Uses multiple processors collections.
to speed up GC collection
http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html
34
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=xxM
Standard Java SE tools can be used to identify potential memory savings
− Use jvisualvm with Linux x86 JDK
Heapdump option
35
37. SE for Embedded Product Overview
Two 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
37
38. Target Market Data – SE for Embedded
Data Highlights from Surveys (till 12/10)
% Evals Java SE-
% Evals Java SE-Embedded
Embedded by Org
by Geo
EME Co
A mp
any
AME
R
Industry Sampling: Educational Sampling:
•Motorola Stanford University
•Lockheed Martin Carnegie Mellon University
•Ricoh John Hopkins University
•Cisco
Rochester Institute of Technology
•Alcatel-Lucent
Pennsylvania State University
38
39. Current Java SE Embedded Offerings
SE 6u21 – latest release available on web Nov 1, 2010
Processor Operating Headless or FPU Java SE Version
System Headful
ARMv5 Linux Headless SFLT 6u21
ARMv6/v7 Linux Headless & VFP 6u21
Headful (v7)
PowerPC Linux Headless Classic HW FP 6u21
E600 core
PowerPC e500v2 Linux
* All configurations dynamicallyHeadless
detect and support Embedded FP 6u21
single or multi-core processors
39
x86 Linux Headless X86 6u21
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
40
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
41
44. 2.6X 1.53X
2.15X 2.17X
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. 44
45. 2X
3.2X
2.5X
Tegra-2 Specs
ARM Cortex-A9
Dual-Core CPU
1GB RAM
1GHZ
* Chart is displaying relative performance differences only. Scores have been proportionately scaled to fit on chart. 45
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
46
47. Java Embedded – ME & SE
CDC HI 1.1.2/
Item SE Embedded
CDC HI 1.6
CDC Spec compliance Available with proven deployment Technically possible, roadmap not
defined
MIPS support Available with proven deployment
Special Embedded FeaturesRomization, AOT, Dual Stack, MVM, headless, memory optimizations,
designed/implemented to be memory efficient multiple GC collectors, in process MVM.
Available Upper Stack PBP/AGUI, MIDP/MSA, OSGi, JavaTV, GEM All SE packages
Static Foot Print (headless) 4MB/7.5MB 32MB
Runtime requirement Typically 8MB to 64MB headless:32MB headful: 64MB to
128MB
Startup Time Cold <300ms, Warm <100-200ms Slower
OS Portability Linux, WinCE, Brew, Symbian, pSOS, VxWorks, Linux, XP Embedded, Linux GC,
OS20, Win32, Solaris, Mac OS X Windows, Solaris, NetBSD, QNX
CPU Portability (w/JIT) ARM, MIPS, X86, PowerPC, Sparc, MIPS, AM34, ARM, x86, PowerPC, Sparc
ST20, SH3/4, ARC
Graphics portability DirectFB, DirectX, MPE, PFC, MicroWindows, QT, X11, Windows
etc
Latest language and API Subset of 1.4.2/ SE 1.6
Subset of 1.6 (planned)
10/26/10 Oracle Internal and Restricted 47 47
48. API Package
Embedded
SE 1.6/1.7 CDC/FP 1.1.2 CDC/FP 1.6
SE
java.applet Yes no no
java.awt Yes no no
java.beans Yes no no
java.io Yes Subset Yes
java.lang Yes Subset Yes
java.math Yes Subset Yes
java.net Yes Yes Yes
java.nio Yes no Yes
java.rmi Yes no no
java.security Yes Subset Yes
java.sql Yes no no
java.text Yes Yes Yes
java.util Yes Subset Yes
java.util.concurrent Yes no Yes
java.util.logging Yes no Subset
java.util.pref Yes no no
java.crypto Yes Yes Yes
javax.security Yes Subset Subset
Javax.* (~70 other packages) Yes no no
org.* Yes no no
omg.org.* Yes no no
Static footprint (with SecOP) 32 MB 4 MB 7.5 MB
10/26/10 Oracle Internal and Restricted 48 48
51. Java SE for Embedded
Example devices
• Routers & Switches • Smart Meters
• ATMs • Storage Appliances • RFID Readers
• Video Conferencing
• Parking Meters • Network Management Systems Systems
• POS Systems • Medical Imaging Systems • In-Flight Entertainment
• Lottery/Gaming Systems • Radar Systems Systems
• Multi Function Printers • Industrial PCs • Video Streaming Systems
• Intelligent Power Module • Factory Automation Systems • Electronic Voting Systems
• Netbooks • Voice Messaging Systems
• Geo-Imaging Devices
• Security Systems
51
52. Java SE Embedded in Smart Metering
EnergyICT
Java SE Embedded Based
Smart Meter Concentrator
52
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
54
55. Sample Embedded ARM Devices
Beagleboard Plug computer Pandaboard
http://beagleboard.org http://www.plugcomputer.org http://pandaboard.org
Beagleboard Specs Pandaboard Specs
Plug Computer Specs
TI OMAP3530 CPU TI OMAP4430 CPU
Marvell ARMv5 CPU
Cortex-A8 Dual Core Cortex-A9
512MB RAM
256MB RAM 1GB RAM
1.2ghz
600Mhz 1Ghz
55
56. Java SE Embedded Platform Example
GuruPlug
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/
56
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
58
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
59
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
60
61. Questions?
<Insert Picture Here>
For more information on Java Embedded:
www.oracle.com/technetwork/java/embedded
Or write me at:
Ben Pashkoff (benjamin.pashkoff@oracle.com)
61
62. Which of the following do YOU think
of
when you think of Java?
A
C
B
D
G
E
F
62