Download Embedded Software - VLSI

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Embedded Systems
Java in an Embedded System
C.-Z. Yang
http://syslab.cse.yzu.edu.tw/~czyang
Sept.-Dec. 2001
Java for Embedded Systems
Deepak Mulchandani
Wind River Systems
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
2
Shift based on Internet
• Traditional distinctions between desktop
systems and embedded systems are on the
basis of functionality.
• Now the emergence of the Internet is
shifting the idea of fixed-function embedded
devices toward more open systems offering
some form of network connectivity.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
3
Embedded Java
• Several reasons
– With Java, developers can target a platform-independent
API and migrate their applications to different devices
without recompiling or re-verifying them.
– The OO nature of Java supports well-structured
development and software reuse.
– The Java Virtual Machine provides a dynamic platform
with a secure execution environment.
• Java is not just a programming language; it
is a complete dynamic platform that
requires extra infrastructure to run on
embedded devices.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
4
Considerations
• Accordingly, its suitability to an application
depends on the device requirements.
• Developers must consider resource,
integration, and real-time performance
requirements to determine Java’s suitability
to an application.
– For example, the bias of the language and platform toward
32-bit processors would not be appropriate for devices
with 4-, 8-, or 16-bit CPUs.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
5
Considerations
• Issues related to memory management and
the interpreted Java VM would hinder
applications that demand strict real-time
performance.
• Another consideration is the size of the
complete Java platform.
– Many people believe that support of a Java VM is all you
need to run Java applications.
– However, to compute the total size of the Java platform
correctly, you must add the size of the Java VM, Java API
package, Java application, and associated native-code
libraries.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
6
Embedded Java Platform Architecture
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
7
Overview
• Two sample devices
– The RTOS supports multithreading (scheduling), memory
management, networking, and peripheral management for
the Java VM.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
8
Architecture of the Java Platform
• The architecture
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
9
Java VM
• The Java VM depends on an RTOS to
provide hardware-specific functionality for
running Java applications.
• This functionality includes threading,
memory management, and execution of
native code.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
10
Java VM
• The device supports four Java API
packages: java.awt, java.net, java.io, and
java.math.
• The packages are layered directly on top of
native-code libraries
– This technique supports the abstraction of Java
applications from platform-specific functionality and
allows the Java API package to remain portable across
platforms.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
11
The Java APIs
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
12
Evolution of Java
• As JDK 1.0.2 evolved to JDK 1.1, the Java
API package was enhanced at a penalty of
size.
– As a result, many embedded manufacturers recognized the
benefits of Java but hesitated to pay the added resource
requirements it places on their devices.
• To address this weakness, JavaSoft
developed four APIs that targeted different
market segments: JDK, PersonalJava,
EmbeddedJava, and Java Card.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
13
Resource Requirements
• Four APIs
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
14
The Proper API
• JDK 1.1.4
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
15
Scaling Java Class Packages
• Static method
– The static method analyzes the application code and
compiles a list of the referenced Java API classes and
packages.
– Using the compiled list, you can go through the Java class
package and remove the unnecessary packages and classes.
– The static method is quick, but prone to some error in
missing classes that are not directly referenced through the
source code.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
16
Scaling Java Class Packages
• Dynamic method
– The dynamic method requires you to run the application
code and generate a log of Java classes your application
references.
– To perform this analysis, you can run your Java application
on a Java VM with the -verbose flag enabled.
– This technique will generate a fairly complete list of all the
Java classes referenced in an application.
– The dynamic method is a lot more accurate than static
analysis since it compensates for classes loaded from other
sources such as the network.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
17
Breaking up the JDK
• Two separate archives
– rt.jar
– i18n.jar
• The impact of a 1.3 Mbtye class package is
a lot easier to absorb on an embedded
device.
• Note that the 1.3 Mbyte figure is for the JDK
class package.
• The PersonalJava and EmbeddedJava class
package will be much smaller.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
18
Memory Management And
Garbage Collection
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
19
Memory Management
• Java applications do not have any explicit
mechanisms for memory management.
• The allocation and deletion of objects is
performed with cooperation between the
Java VM and the garbage collector.
– On the one hand, this isolates the developer from the
process of keeping track of memory use in an application.
– On the other hand, the garbage collection process is
nondeterministic and cannot be scheduled.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
20
The Problem
• As a result, you cannot be sure exactly
when the Java VM will clean up the object
heap, since
– it runs the garbage collector as a low-priority thread and
– does not include mechanisms to directly control the
behavior of the garbage collector.
• The Java API package does provide a
method, System.gc(), to call the garbage
collector, but this method does not
guarantee anything; it merely sends the
Java VM a suggestion to clean up the object
heap.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
21
Object Heap States in the Java VM
• The information is based on ratios and
divided into three categories: green, yellow,
or red state.
– When there is no shortage of memory, the Java VM
operates in the green state.
– When memory drops below a specified threshold, the Java
VM enters the yellow state, which means it should
schedule a garbage collection soon.
– If the application keeps executing, the Java VM enters the
red state, which means the object heap is almost saturated
and garbage collection needs to be done immediately.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
22
The Java VM Threading Model
• An example
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
23
The Problem of the Garbage Collector
• The garbage collector poses a problem in
that it tends to lock down all the Java
threads while it cleans out unused objects
from the system.
• The lockdown ensures that the state of the
heap remains stable, but it adversely affects
real-time performance of Java applications.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
24
The Problem of the Garbage Collector
• A simple workaround to this problem is to
continue to allow the RTOS to manage
operations of the device—interrupts, device
management, and task scheduling—with
those tasks running at a higher priority.
– A Java application should not be written to rely on any
RTOS or system-specific functionality, nor should it make
any assumptions about scheduling or timing.
– Any specific portions of the Java application that are
performance-critical can be implemented in native code.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
25
Java Performance
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
26
Performance Issue
• The Java class file format and the Java VM
– the cross-platform promise
• On the target device, each Java bytecode is
executed using the interpreter loop
embedded in the Java VM.
• The Java VM interpreter loop is responsible
for translating each Java bytecode into
equivalent native-code functions while the
application executes.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
27
Performance Issue
• Java bytecode applications tend to run
slower than native applications since
– optimizations cannot be performed at runtime and
– the translation is a fairly serial process.
• Based on early benchmarks, Java
applications tend to run 20 to 30 percent
slower than applications written in C.
• This is not a significant problem for small
applications, but it can be a serious issue
when it comes to running any sizable
applications.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
28
Average Execution-time Allocation
• The table shows the time spent in native
code execution at 1 percent of overall
execution time.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
29
Optimization Technology
• A specific optimization technology to
improve Java application performance can
only be applied to speed the interpretation
of bytecodes.
• The techniques to choose from include the
ROMizing technology presented earlier.
• Other solutions focus on three main areas:
Java native compilers, JITs, and Java Chips.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
30
Java Compilers
• Using Java Compilers allows developers to
write inter-operable Java, C, and C++ code.
• Pros
– The benefits are the increased performance by having your
system rely more on the mature native compilers rather
than bytecode-based Java compilers.
• Cons
– On the downside, you lose the benefits of the dynamic Java
platform as soon as portions are converted to native code.
– Also, for device updates you will have to rely on native
code patches rather than using the Java VM to selectively
update certain aspects of your application.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
31
Just-In-Time Compilers
• Just-in-Time Compilers are a popular
approach to improving Java performance.
• JIT compilers convert Java bytecodes to
native code while an application is running.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
32
Just-In-Time Compilers
• The JIT approach does not work as well:
– If the application performs operations such as graphics or
floating-point operations, then JIT compilers do not give a
large performance boost.
– If the application constantly creates objects, the garbage
collector would interfere with the operation of the JIT.
– If performance is mostly a function of optimizations, JIT
compilers are limited by their status as a runtime
component.
• JIT compilers can also take up large
amounts of RAM.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
33
Java Chips
• Java chips have been offered as a hardware
option to improve Java performance.
• You still need a Java VM (without interpreter
loop) and RTOS to put together a complete
Java platform, so the Java chips are
primarily performance enhancers.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
34
Embedded Internet Systems
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
35
Comparisons
• Desktop v.s. Embedded Internet Systems
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
36
Two Java Tech Paths
• Java for “soft” embedded systems with
fewer resource and response-time
constraints.
– The “soft” Java approach ports a subset of the desktop Java
VM directly into the RTOS environment.
– Although it is optimized for small memory footprints and
diverse visual displays, this results in a relatively large (by
embedded standards) and high-cost end product.
• Real-time Java for deeply embedded “hard
real-time” systems.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
37
Hp’s Native Java Compilers Approach
• HP is also developing a third approach—
native Java compilers—which translate
Java programs directly into CPU machine
code.
• Although native compilers break Java’s
original mantra of platform neutrality, they
run much faster than Java bytecodes that
are interpreted by the Java VM for execution
on the CPU.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
38
Embedded Java in a Web-Based
Teleradiology System
Andrea Abrardo and A.L. Casini
University of Florence
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
39
Medinet
•
This paper present a pilot teleradiology application based on
embedded Java in the Web. It investigates how the use of Java can
solve the issues involved in the implementation of a teleradiology
system over the web.The proposed solution is being tested in real
hospital environments and can be used as the backbone for the
development of complex multiplatform client-server applications in
the field of teleradiology.
•
Medinet is a Web-based solution for teleradiology currently
undergoing clinical evaluation as part of the European Union
advanced communications technologies and services program. The
system uses embedded Java applets to permit remote access to
radiologic data and diagnostic services.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
40
Main Network Requirement of
Today’s Telemedicine Application
• Enable the sharing of data across
heterogeneous network environments.
• Enable the implementation of strong
security measures.
– Secure identification
– Access control strategies
– Encryption methods - privacy of patient data
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
41
Overall Architecture of Medinet
• The overall architecture
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
42
Access to Remote Medical Image
Databases on the Web
• Two models
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
43
Collaborative Diagnosis through
Event Broadcasting
• The event broadcasting method works
particularly well with web-based
collaborative application.
– It fits the Java applet.
– Conference agent must distribute only small amounts of
data to the participants.
• The socket interface provides backbone
communication and allows the bidirectional
transmission of data among the applets and
the Java sever.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
44
Mednet’s Teleradiology Functions
• Access to Medical
Diagnostic Image
database
– proposed solution
• three tiered
• Indirect Access Method
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
45
Mednet’s Teleradiology Functions
• Access to telediagnosis services
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
46
Results
• Users and Performance
– users  -> threads in Java VM  -> performance 
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
47
Results
• Compression or not and Performance
• Latecomers
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
48
Conclusions
• Managing high-volume images and their
processing requires efficient VM.
• The security manager, along with digitally
signed applets must be used to give the
necessary privileges to the retrieved applets.
• Security of the system must be more
sophisticated when dealing with real patient.
• The option to integrate intranet and extranet
services with different privilege access.
[email protected]
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
49
ACM Code of Ethics
• As an ACM member I will ....
–
–
–
–
–
–
–
–
–
[email protected]
Contribute to society and human well-being.
Avoid harm to others.
Be honest and trustworthy.
Be fair and take action not to discriminate.
Honor property rights including copyrights and patent.
Give proper credit for intellectual property.
Respect the privacy of others.
Honor confidentiality.
Embedded Systems - Java in an Embedded System
元智大學資訊工程系
50