2. Embedded Devices
Typically fixed-function devices
Limited user interface
ISA
OS
Software typically closely tied to the hardware
2
Image: www.eeweb.com
3. Embedded Devices Are Evolving
We see a new class of embedded systems emerging
Advanced processors
Larger set of capabilities
Enhanced user interface / user experience
Open platforms for a software ecosystem
3
Image: www.apple.com
4. Mobile Transforms Embedded Systems
Image: www.honeywell.com
Image: www.nest.com
Image: www.nikon.com
Image: www.apple.com
6. OSGi
Dynamic Module System for the Java Runtime
Original domain: Home Gateway
– Multiple software packages need to co-exist on the same machine
– Long-running software
– Periodic maintenance and updates requires
– Ideally with minimal downtime and no interruption of unrelated software packages
6
• Java on the Embedded Device
• Pros:
• bridges heterogeneity
• can run the same code in the cloud or on the device
• Cons:
• updates and maintenance
7. Module Management
Traditional Java: The mystical class path
java –cp commons-X.jar:foo.jar:bar.jar my.application.MainClass
• Which module contains the main class?
• What are the dependencies between foo.jar and bar.jar?
• What happens if bar.jar is upgraded to bar-1.01.jar?
8. OSGi – Module Layer
Modules are called Bundles
– JAR files with additional metadata
Runtime system: The Framework
– Lifecycle management
Bundles implement isolation and locality
Interaction between bundles is limited
– Shared code through package imports
– Inter-bundle calls through services
– Monitoring system state through events
9. The Lifecycle of a Bundle
Management: Install / Start / Stop /
Uninstall bundles at runtime.
OSGi keeps track of dependencies
What happens if a Bundle is
uninstalled?
From the OSGi Core Specifications
10. The OSGi Framework
OSGi Framework
BundleA
Package 1
Package 2
Package 3
BundleB
Package I
Package II
Exported Package Exported Package
Private Package
Import
Export-Package: Package 1 Export-Package: Package I, Package II
Import-Package: Package 1
• Packages can be versioned
• OSGi encourages semantic versioning of bundles and packages
11. OSGi Services: Reducing Coupling
Modules allow for a compositional approach to building applications
But: Package dependencies are explicit.
– Limits the modularity!
Solution: Services
– Idea: Separate the interface from the implementation
Interface
Implementation
Module
Module Module Service Service
12. The Service Registry
The OSGi framework maintains a central service registry
Bundles can register their own services and retrieve services provided by other
bundles
Services can be registered with a set of properties
– Additional description of the service, can be used to model constraints or do
“best fit matching”
No runtime overhead for using services after lookup!
Registry
13. OSGi Services
Composition at runtime
Loosely-coupled interaction through services
The system is dynamic
13
14. 14
Concierge
Question: What is the (minimum) overhead of OSGi?
My answer: Concierge
– OSGi R3 core implementation developed during my PhD at ETH
Zurich
– optimized for mobile and embedded devices, has a footprint of only
86kB
– People found the source code readable and understandable: 7
Java classes + 7 inner classes.
[J.S. Rellermeyer and G. Alonso: Concierge – A Service Platform for Resource-Constrained Devices. In:
EuroSys 2007].
Image: http://www.linksys.com
15. 15
Consistency across Platforms
iPAQ 3870
Linux Familiar 0.8
SA-1110 CPU
64 MB RAM
SableVM
Zaurus 5500G
Linux Embedix
SA-1110 CPU
64 MB RAM
Sun cvm
Nokia 9300i
SymbianOS
TI OMAP 1510 CPU
80 MB RAM
IBM J9
iPAQ 5550
Windows Mobile
PXA255 CPU
128 MB RAM
IBM J9
LinkSys NSLU2
Unslung
IXP420 CPU
32 MB RAM
JamVM
20. OSGi R4
OSGi R4: multiple versions, class spaces
Fragments
Require-Bundle
20
my.bundle.one 1.0 my.bundle.two
exports my.package; version 1.0
imports
my.bundle.one 2.0
exports my.package; version 2.0
21. OSGi R5
OSGi R5: generic requirements and capabilities
Many hooks into the framework to manipulate the observed state
21
my.bundle.one 1.0
my.bundle.two
Provide capability foo.bar{a=10, b=[1,2,3]}
Require capability foo.bar filter=(!(a>10))
23. Concierge goes Eclipse
Targets:
Full OSGi core R5 compatibility
Keep a small footprint to work well on embedded devices
– Currently < 350kB footprint
Remain “readable”
– Currently 9 classes
Remain backwards-compatible
Being a sandbox for innovation around OSGi
23
Image: http://www.eclipse.org
24. Demo
BeagleBone
AM335x 720MHz ARM Cortex-A8
256MB DDR2 RAM
4GB microSD card
runs Angstrom Linux Distribution
Java SE Embedded 1.7.0_21-b11
Concierge R5 alpha
24
Image: http://www.beaglebone.org
25. REST Interface
Designed for the cloud
Very useful for embedded systems as well
Examples
– GET http://my_host/framework/bundles/representations
– POST http://my_host/framework/bundles
– GET http://my_host/framework/bundle/5/state
– GET http://my_host/framework/services/(objectClass=org.osgi.*)/representations/
This is work in progress (RFC 182)
http://www.osgi.org/download/osgi-early-draft-2013-03.pdf
25
27. Juggle
Model critical functionality as services
–Module with hardware-accelerated
service
–Co-Module with dynamically
accelerated service
“Juggle” with the accelerators
27
28. Juggle Prototype System
Xilinx Virtex-II Pro
PPC 440 core, 300 MHz
256 MB DDR SRAM
Linux 2.6.35 (patched)
JVM
–IcedTea Zero, IcedTea Cacao, or IBM J9
OSGi Framework
– Concierge
Juggle
– Adds support for loading and managing co-bundles
– Manages the FPGA and the reprogramming
28
Image: http://www.xilinx.com
29. Evaluation
PRR of about 16% of the chip real estate
Reprogramming time: 11 – 25 msec.
(Literature: max. 30 msec)
Switching the socket bridge: 3 msec.
Initial load time for a hardware accelerated bundle: ~ 100 msec.
Initial load time for a co-bundle: < 1sec
29