+ All Categories
Home > Documents > Embedded Java Research

Embedded Java Research

Date post: 25-Feb-2016
Category:
Upload: lalo
View: 30 times
Download: 0 times
Share this document with a friend
Description:
Embedded Java Research. Geoffrey Beers Peter Jantz December 18, 2001. General Java Overview. Robust object-oriented language developed by Sun Microsystems in 1995. Basic idea was to create a language that can run on any platform - PowerPoint PPT Presentation
Popular Tags:
66
Embedded Java Research Embedded Java Research Geoffrey Beers Geoffrey Beers Peter Jantz Peter Jantz December 18, 2001 December 18, 2001
Transcript
Page 1: Embedded Java Research

Embedded Java ResearchEmbedded Java Research

Geoffrey BeersGeoffrey BeersPeter JantzPeter Jantz

December 18, 2001December 18, 2001

Page 2: Embedded Java Research

General Java OverviewGeneral Java Overview

Robust object-oriented language developed Robust object-oriented language developed by Sun Microsystems in 1995.by Sun Microsystems in 1995.

Basic idea was to create a language that can Basic idea was to create a language that can run on any platformrun on any platform– Even early Java models and development Even early Java models and development

considered the future of embedded system considered the future of embedded system programming.programming.

““Write-once, run anywhere” ideology.Write-once, run anywhere” ideology.

Page 3: Embedded Java Research

Typical Hardware View of Java ApplicationsTypical Hardware View of Java Applications

ApplicationProgram.javaApplicationProgram.java

Java APIJava API

Java Virtual MachineJava Virtual Machine

Hardware-Based PlatformHardware-Based Platform

Java Java PlatformPlatform}}

Page 4: Embedded Java Research

Embedded Java Application EnvironmentEmbedded Java Application Environment

                                  

                                             

Taken from Sun MicrosystemsTaken from Sun Microsystems

Page 5: Embedded Java Research

Embedded Java Application Embedded Java Application EnvironmentEnvironment

Unlike traditional Java packages, the Unlike traditional Java packages, the Embedded Java environment is far more Embedded Java environment is far more configurable.configurable.– Do we really need I/O?Do we really need I/O?– What packages do we really What packages do we really needneed??– Is a GUI required?Is a GUI required?

Ability to have all standard JDK Ability to have all standard JDK components (except Applet), with the components (except Applet), with the ability to only use what is ability to only use what is necessarynecessary..

Page 6: Embedded Java Research

Advantages of the Java Advantages of the Java Technology ModelTechnology Model

SimplicitySimplicity– Easier language to learn than traditional C/C++ and still has Easier language to learn than traditional C/C++ and still has

object-oriented methodology.object-oriented methodology. Security and SafetySecurity and Safety

– Java programs have more robust security checking, with the Java programs have more robust security checking, with the RTE creating a “sandbox” where applications can run RTE creating a “sandbox” where applications can run safely.safely.

– Lack of pointers eliminates direct memory accessLack of pointers eliminates direct memory access Portability and Robust DistributionPortability and Robust Distribution

– Applications can be easily developed on desktop systems Applications can be easily developed on desktop systems and ported, with minimal effort, to target device.and ported, with minimal effort, to target device.

– ““Write-once, run anywhere” mentality.Write-once, run anywhere” mentality.

Page 7: Embedded Java Research

Disadvantages of Embedded JavaDisadvantages of Embedded Java

Huge speed disadvantage. Interpreted Java code is Huge speed disadvantage. Interpreted Java code is still 5-10 times slower than a similar C still 5-10 times slower than a similar C application.application.– Improvements made to JVM technology have enhanced Improvements made to JVM technology have enhanced

this over the years.this over the years.– Often based on how the application is writtenOften based on how the application is written

» A well-written Java program can out-perform a poorly written A well-written Java program can out-perform a poorly written C programC program

– For embedded applications do we really need to For embedded applications do we really need to interpret code, or can we use interpret code, or can we use native-compiled codenative-compiled code??

Page 8: Embedded Java Research

Disadvantages of Embedded JavaDisadvantages of Embedded Java

Embedded Java technology still relatively new and Embedded Java technology still relatively new and industry support has been slow to catch-on.industry support has been slow to catch-on.

Biggest disadvantage: Lack of RTOS support or Biggest disadvantage: Lack of RTOS support or standardstandard– Early embedded Java applications were very similar to Early embedded Java applications were very similar to

conventional desktop programs. Fine for some apps, conventional desktop programs. Fine for some apps, but deadline control and interrupt handling are but deadline control and interrupt handling are necessary.necessary.

– Great improvement in this genre since 1998.Great improvement in this genre since 1998.

Page 9: Embedded Java Research

Pouring Java into Embedded Pouring Java into Embedded Device DevelopmentDevice Development

Some of the features that have made Java an excellent Some of the features that have made Java an excellent choice for desktop programming cause problems on an choice for desktop programming cause problems on an embedded system. Most of these problems have embedded system. Most of these problems have solutions as well as trade-offs.solutions as well as trade-offs.

ProblemProblem SolutionSolution Trade-offTrade-offNot as fast as C Not as fast as C or Assemblyor Assembly

Native-compiled code (AOT Native-compiled code (AOT compiler)compiler)

Loss of portabilityLoss of portability

Unpredictable Unpredictable timingtiming

New garbage collection New garbage collection algorithm and better algorithm and better memory management memory management control.*control.*

More control More control means more means more responsibilityresponsibility

Cannot directly Cannot directly control hardwarecontrol hardware

Native hardware interfacesNative hardware interfaces Development may Development may require multiple require multiple languageslanguages*Support for this has been greatly improved through RTSJ*Support for this has been greatly improved through RTSJ

Page 10: Embedded Java Research

Challenges of Embedded JavaChallenges of Embedded Java

Memory RequirementsMemory Requirements Execution speedExecution speed Garbage collection and memory Garbage collection and memory

managementmanagement Real-time OS supportReal-time OS support

Page 11: Embedded Java Research

Typical Memory Requirements Typical Memory Requirements of Java Systemsof Java Systems

MinimumMinimum MediumMedium High-endHigh-end

ProcessorProcessor < 100 MHz< 100 MHz< 8K I/D cache< 8K I/D cache

100 – 200 MHz100 – 200 MHz< 8K I/D cache< 8K I/D cache

200 MHz +200 MHz +32K + I/D cache32K + I/D cache

MemoryMemory 2 MB ROM2 MB ROM2 MB RAM2 MB RAM

2-4 MB ROM2-4 MB ROM4-8 MB RAM4-8 MB RAM

> 8 MB ROM> 8 MB ROM> 16 MB RAM> 16 MB RAM

Page 12: Embedded Java Research

Real-time Java IssuesReal-time Java Issues Necessary to handle hard and soft deadline Necessary to handle hard and soft deadline

constraints.constraints. Support for timely execution of tasks and Support for timely execution of tasks and

interrupt routinesinterrupt routines Thread priorities and lockingThread priorities and locking Garbage collection and the embedded Garbage collection and the embedded

model.model.– How do we know we’re not going to use the How do we know we’re not going to use the

dynamic memory again?dynamic memory again?

Page 13: Embedded Java Research

Garbage CollectionGarbage Collection Garbage collection (GC) is great idea for larger Garbage collection (GC) is great idea for larger

system development, but can create major system development, but can create major problems in an embedded environment.problems in an embedded environment.

Major problem for hard real-time systems.Major problem for hard real-time systems. Early solution: Avoid GC altogether.Early solution: Avoid GC altogether.

– Allocate memory dynamically, but never delete. If it’s Allocate memory dynamically, but never delete. If it’s not needed again, waste space, but will be available if not needed again, waste space, but will be available if needed.needed.

PERC handles GC rather well; RTJS also defines PERC handles GC rather well; RTJS also defines a GC standard.a GC standard.

Page 14: Embedded Java Research

Early Real-Time ConsiderationsEarly Real-Time Considerations Although Java had enormous potential as an Although Java had enormous potential as an

embedded system development tool, the embedded system development tool, the real-time issues were still a reality.real-time issues were still a reality.

Ideally, needed a way to control garbage Ideally, needed a way to control garbage collection and optimize memory.collection and optimize memory.

Considerations for real-time threads and Considerations for real-time threads and scheduling models.scheduling models.

These considerations introduced as early as These considerations introduced as early as 1995.1995.

Page 15: Embedded Java Research

Real-Time Specification for JavaReal-Time Specification for Java Real-time embedded issues invoked need for RT Real-time embedded issues invoked need for RT

Java specification.Java specification. PERC has been developing real-time Java API PERC has been developing real-time Java API

extensions since 1997, but still a need for extensions since 1997, but still a need for organized structure and universal standard.organized structure and universal standard.

Java Community Process formed in 1998 to Java Community Process formed in 1998 to resolve some of the real-time issues and come to a resolve some of the real-time issues and come to a standard.standard.– Standard known as Real-Time Specification for Java Standard known as Real-Time Specification for Java

(RTSJ), and was officially completed in Nov. 2001(RTSJ), and was officially completed in Nov. 2001

Page 16: Embedded Java Research

RTSJ Guiding PrinciplesRTSJ Guiding Principles

Applicability to particular Java environments.Applicability to particular Java environments.– Do not include specs that restrict use to a particular Do not include specs that restrict use to a particular

Java environment.Java environment. Backward compatibilityBackward compatibility

– RTSJ shall not prevent existing, non real-time Java RTSJ shall not prevent existing, non real-time Java programs, from executing on implementations of the programs, from executing on implementations of the RTSJ.RTSJ.

““Write once, run anywhere” mentality should be Write once, run anywhere” mentality should be followed as much as possible.followed as much as possible.

Page 17: Embedded Java Research

RTSJ Guiding Principles (cont.)RTSJ Guiding Principles (cont.) RTSJ should address real-time system practice and RTSJ should address real-time system practice and

allow for the incorporation of advanced features in allow for the incorporation of advanced features in the future.the future.

Predictable execution as first priority in all Predictable execution as first priority in all tradeoffs.tradeoffs.– May come at expense of general-computing May come at expense of general-computing

performance, but will allow for greater real-time performance, but will allow for greater real-time integration.integration.

No syntactic extensionNo syntactic extension– RTSJ will not introduce new keywords or other RTSJ will not introduce new keywords or other

syntactic extension to the Java language.syntactic extension to the Java language.

Page 18: Embedded Java Research

Real-Time Specification for JavaReal-Time Specification for Java

Finalized in November 2001.Finalized in November 2001. Standard specification for garbage Standard specification for garbage

collection, memory management, and collection, memory management, and task/thread control.task/thread control.

Additional classes and extensions to Additional classes and extensions to standard Java JDK.standard Java JDK.– However, no new syntax was necessary.However, no new syntax was necessary.

Page 19: Embedded Java Research

javax.realtimejavax.realtime Package Package

Real-time specification provides Real-time specification provides modifications to the Java Language Spec. modifications to the Java Language Spec. and JVM Spec.and JVM Spec.

New APIs to enable the creation, New APIs to enable the creation, verification, analysis, execution, and verification, analysis, execution, and management of real-time Java threads.management of real-time Java threads.

New APIs in a standard extension package, New APIs in a standard extension package, javax.realtimejavax.realtime..

Page 20: Embedded Java Research

Seven Areas of EnhancementSeven Areas of Enhancement

Thread scheduling and dispatchingThread scheduling and dispatching Memory managementMemory management Synchronization and resource sharingSynchronization and resource sharing Asynchronous event handlingAsynchronous event handling Asynchronous transfer of controlAsynchronous transfer of control Thread terminationThread termination Physical memory accessPhysical memory access

Page 21: Embedded Java Research

Thread Scheduling and DispatchingThread Scheduling and Dispatching

Programmatic assignment of parameters Programmatic assignment of parameters appropriate for the underlying scheduling appropriate for the underlying scheduling mechanism in use.mechanism in use.

Creation, management, admittance, and Creation, management, admittance, and termination of real-time Java threads.termination of real-time Java threads.– Threads are constructed as instances of class Threads are constructed as instances of class

javax.realtime.RealtimeThread, javax.realtime.RealtimeThread, which extends which extends java.lang.Threadjava.lang.Thread..

Flexibility in thread scheduling framework allows Flexibility in thread scheduling framework allows future specifications to build on the RTSJ.future specifications to build on the RTSJ.

Page 22: Embedded Java Research

Thread Scheduling (Cont.)Thread Scheduling (Cont.)

Base-scheduling mechanism is preemptive, Base-scheduling mechanism is preemptive, priority-based FIFO.priority-based FIFO.

At least 28 unique priority levels.At least 28 unique priority levels. Threads waiting to acquire a resource must Threads waiting to acquire a resource must

do so in execution eligibility order.do so in execution eligibility order.

Page 23: Embedded Java Research

Memory ManagementMemory Management

RTSJ introduces concept of memory area.RTSJ introduces concept of memory area.– Area of memory used for the allocation of objects.Area of memory used for the allocation of objects.

Some memory areas exist outside of the heap and Some memory areas exist outside of the heap and place restrictions on what the system and garbage place restrictions on what the system and garbage collector may do with objects allocated within. collector may do with objects allocated within.

Objects in some memory areas are never garbage Objects in some memory areas are never garbage collected.collected.– Garbage collector must be capable of scanning these Garbage collector must be capable of scanning these

memory areas for references to any object within the memory areas for references to any object within the heap to preserve the integrity of the heap.heap to preserve the integrity of the heap.

Page 24: Embedded Java Research

Four Memory AreasFour Memory Areas Scoped MemoryScoped Memory

– Objects have lifetime defined by syntactic scope.Objects have lifetime defined by syntactic scope. Physical MemoryPhysical Memory

– Objects created within specific physical memory Objects created within specific physical memory regions having certain characteristics.regions having certain characteristics.

Immortal MemoryImmortal Memory– Objects cannot be destroyed; once allocated they stay Objects cannot be destroyed; once allocated they stay

until the end of the application.until the end of the application. Heap MemoryHeap Memory

– Objects represent an area of memory on the heap.Objects represent an area of memory on the heap.

Page 25: Embedded Java Research

Memory Class HierarchyMemory Class Hierarchy

ObjectObject

MemoryAreaMemoryArea

HeapMemoryHeapMemory

ImmortalPhysicalMemoryImmortalPhysicalMemory

ScopedMemoryScopedMemoryLTMemoryLTMemory

ImmortalMemoryImmortalMemoryScopedPhysicalMemoryScopedPhysicalMemory

VTMemoryVTMemory

RawMemoryAcessRawMemoryAcess

PhysicalMemoryFactoryPhysicalMemoryFactory

RawMemoryFloatAcessRawMemoryFloatAcess

Taken from Prof. Insup Lee, Univ. Penn.Taken from Prof. Insup Lee, Univ. Penn.

Page 26: Embedded Java Research

Memory ManagementMemory Management Immortal Memory AreaImmortal Memory Area

– One ImmortalMemory object per JVM.One ImmortalMemory object per JVM.– Used for sharing between real-time threads.Used for sharing between real-time threads.– No control in the program can ever leave the No control in the program can ever leave the

immortal memory.immortal memory. Scoped Memory AreaScoped Memory Area

– Associated with one or more scopes.Associated with one or more scopes.– Scopes may have more than one associated Scopes may have more than one associated

memory area.memory area.

Page 27: Embedded Java Research

Synchronization and Resource SharingSynchronization and Resource Sharing

Implementations of the current keyword Implementations of the current keyword “synchronized” include one or more “synchronized” include one or more algorithms that prevent or bound execution algorithms that prevent or bound execution eligibility inversion among real-time Java eligibility inversion among real-time Java threads that share the resource.threads that share the resource.

Priority inheritance provided by default, Priority inheritance provided by default, with optional ceiling emulation.with optional ceiling emulation.

Page 28: Embedded Java Research

Asynchronous EventsAsynchronous Events

Some internal or external event that Some internal or external event that happens.happens.– Not all real-life events are predictable in time Not all real-life events are predictable in time

and frequency.and frequency. System needs to respond to the changing System needs to respond to the changing

environment.environment.– Ability of real-time systems to react to the Ability of real-time systems to react to the

events requires reliable asynchrony techniques.events requires reliable asynchrony techniques.

Page 29: Embedded Java Research

Asynch. Event Class HierarchyAsynch. Event Class Hierarchy

AsyncEventAsyncEventSchedulable (I)Schedulable (I)

AsyncEventHandlerAsyncEventHandler

BoundAsyncEventHandlerBoundAsyncEventHandler

AsyncEventHandler behaves like AsyncEventHandler behaves like Thread. It has a run() method.Thread. It has a run() method.BoundAsynchronousHandler can BoundAsynchronousHandler can be used for added timeliness by be used for added timeliness by binding each handler to a dedicated binding each handler to a dedicated thread.thread.

ObjectObjectRunnable (I)Runnable (I)

Taken from Prof. Insup Lee, Univ. Penn.Taken from Prof. Insup Lee, Univ. Penn.

Page 30: Embedded Java Research

Asynchronous Event HandlingAsynchronous Event Handling

AsyncEventAsyncEvent is an object that is programmatically is an object that is programmatically bound to an bound to an AsyncEventHandlerAsyncEventHandler. The . The AsyncEventHandlerAsyncEventHandler class implements class implements RunnableRunnable, , and the overridden and the overridden run()run() method is executed when method is executed when the the AsyncEventAsyncEvent is triggered. is triggered.

Handlers execute with the semantics of a real-time Handlers execute with the semantics of a real-time thread.thread.– RTSJ does not require that the handlers be RTSJ does not require that the handlers be

implemented as threads, only that they execute as if implemented as threads, only that they execute as if they were.they were.

Page 31: Embedded Java Research

Asynchronous Event HandlingAsynchronous Event Handlingimport javax.realtime.*;public class HardwareEventExample extends AsyncEvent {

private in interruptNum;// construct new HW Event for given interruptpublic HardwareEventExample(int num) {

interruptNum = num;}// bind handler to interruptpublic void setHandler(AsyncEventHandler h) {

super.setHandler(h);Hardware.bind(interruptNum,h);

}}class HardwareEventHandler extends AsyncEventHandler {

private int interruptCount = 0;// interrupt handler methodpublic void handleAsyncEvent() {

interruptCount++;// driver code follows

}}

Page 32: Embedded Java Research

Asynchronous Transfer of Asynchronous Transfer of ControlControl

Change in environment needs immediate Change in environment needs immediate attention.attention.

Abandon current execution and take Abandon current execution and take appropriate action.appropriate action.

Page 33: Embedded Java Research

Asynchronous Transfer of Asynchronous Transfer of ControlControl

Methods that have Methods that have throwsthrows clause, including clause, including AsynchronouslyInterruptedExceptionAsynchronouslyInterruptedException ( (AIEAIE) ) in their signature will have that exception in their signature will have that exception raised by the JVM when the raised by the JVM when the interrupt()interrupt() method for their thread is called.method for their thread is called.

Page 34: Embedded Java Research

AIE (AsynchronouslyInterruptedException) AIE (AsynchronouslyInterruptedException) Class HierarchyClass Hierarchy

Interruptible (I)Interruptible (I)ExceptionException

ObjectObject

ThrowableThrowable

InterruptedExceptionInterruptedException

AsynchronouslyInterruptedExceptionAsynchronouslyInterruptedException

TimedTimed

Parameter for Parameter for AIE.doInterruptible()AIE.doInterruptible()

Taken from Prof. Insup Lee, Univ. Penn.Taken from Prof. Insup Lee, Univ. Penn.

Page 35: Embedded Java Research

Asynchronous Thread Asynchronous Thread TerminationTermination

Asynchronous Event Handling and ATC Asynchronous Event Handling and ATC provides ways to manage execution in a provides ways to manage execution in a real-time environment asynchronously.real-time environment asynchronously.

By implementing these two together, we By implementing these two together, we can achieve asynchronous thread can achieve asynchronous thread termination.termination.

Page 36: Embedded Java Research

Physical Memory AccessPhysical Memory Access

RTSJ defines a class that allows byte-level RTSJ defines a class that allows byte-level access to physical memory.access to physical memory.

Also a class that allows construction of Java Also a class that allows construction of Java objects at particular address locations in objects at particular address locations in physical memory.physical memory.

Page 37: Embedded Java Research

PERC and Embedded JavaPERC and Embedded Java

PERC (Portable Executive for Reliable PERC (Portable Executive for Reliable Control) – developed by NewMonicsControl) – developed by NewMonics

Virtual Machine specifically for embedded Virtual Machine specifically for embedded systemssystems

Implements language extensions Implements language extensions specifically designed to handle real-time specifically designed to handle real-time activitiesactivities

Page 38: Embedded Java Research

PERC and OS SupportPERC and OS Support

Available for wide variety of platformsAvailable for wide variety of platforms JDK 1.3 compatibilityJDK 1.3 compatibility VxWorks, VxSim, OSE, OSE Softkernel, VxWorks, VxSim, OSE, OSE Softkernel,

Linux, and WinNT supportLinux, and WinNT support Will be interesting to see PERC’s future Will be interesting to see PERC’s future

now that RTSJ has been created.now that RTSJ has been created.

Page 39: Embedded Java Research

Java technologies from Sun Java technologies from Sun

Architecture - contains libraries, JVM and Architecture - contains libraries, JVM and SDK SDK

Configuration - Virtual Machine and Configuration - Virtual Machine and minimal set of API’s minimal set of API’s

Profile - adds more API’s to make a Profile - adds more API’s to make a complete specification for a devicecomplete specification for a device

Page 40: Embedded Java Research

ArchitecturesArchitectures

J2EE (Enterprise Edition)J2EE (Enterprise Edition)– Used in Embedded Server ApplicationsUsed in Embedded Server Applications

J2SE (Standard Edition)J2SE (Standard Edition)– For writing Applets and other applicationsFor writing Applets and other applications

J2ME (Micro Edition)J2ME (Micro Edition)– For Embedded SystemsFor Embedded Systems

Page 41: Embedded Java Research

J2ME and Java Card HierarchyJ2ME and Java Card Hierarchy

CVM

J2ME CDC Libraries

KVM Java Card VM

Edition =Core Libraries

+ VM

PersonalProfile

J2ME CDLC Libraries Java Card API

J2ME Java Card

Profiles MIDPProfile

GSMProfile

Open PlatformProfile

Page 42: Embedded Java Research

ConfigurationsConfigurations CDC (Connected Device Configuration)CDC (Connected Device Configuration)

– For next generation devices (car navigations For next generation devices (car navigations systems)systems)

– Coupled with CVMCoupled with CVM CDLC (Connected Device Limited CDLC (Connected Device Limited

Configuration)Configuration)– For smaller devices with limited memory (cell For smaller devices with limited memory (cell

phones, PDA’s)phones, PDA’s)– Coupled with KVMCoupled with KVM

Page 43: Embedded Java Research

Virtual MachinesVirtual Machines

Older JVM’sOlder JVM’s– Personal JavaPersonal Java– Embedded JavaEmbedded Java– Java CardJava Card

Current JVM’sCurrent JVM’s– CVMCVM– KVMKVM

Page 44: Embedded Java Research

Personal JavaPersonal Java

pJava is a modified version of the standard pJava is a modified version of the standard Java virtual machine (version 1.1)Java virtual machine (version 1.1)

Uses a minimum of 8 MB RAMUses a minimum of 8 MB RAM Contains the full AWT implementationContains the full AWT implementation Includes tools for building compressed Includes tools for building compressed

ROM images of class filesROM images of class files

Page 45: Embedded Java Research

Embedded JavaEmbedded Java

More of a licensing tool to let companies More of a licensing tool to let companies choose which features companies want for choose which features companies want for their devices.their devices.

Java Filter takes list of class dependencies Java Filter takes list of class dependencies and removes unused libraries.and removes unused libraries.

Java Check reassures that the correct API’s Java Check reassures that the correct API’s are used.are used.

Page 46: Embedded Java Research

Java CardJava Card

Specialized compiler and API’s for running Specialized compiler and API’s for running Java on smart cards.Java on smart cards.

Examples of smart cardsExamples of smart cards– Memory cards can only retrieve data. Phone Memory cards can only retrieve data. Phone

cards are one example.cards are one example.– Cards with microprocessors and less than 8K Cards with microprocessors and less than 8K

memory. Mostly used for storing money and memory. Mostly used for storing money and security purposes.security purposes.

Page 47: Embedded Java Research

C Virtual Machine (CVM)C Virtual Machine (CVM)

Uses Java 2 feature setUses Java 2 feature set Built on Java 1.2 specificationsBuilt on Java 1.2 specifications For devices that have at least 2 MB of For devices that have at least 2 MB of

memory and 16 or 32 bit processorsmemory and 16 or 32 bit processors

Page 48: Embedded Java Research

K Virtual Machine (KVM)K Virtual Machine (KVM)

Runs on systems with as low as 160KB Runs on systems with as low as 160KB total memorytotal memory

Object code is 50K – 80KObject code is 50K – 80K Can run on 16 bit processors clocked to as Can run on 16 bit processors clocked to as

low as 25 MHzlow as 25 MHz Implemented in native code for Implemented in native code for

performanceperformance

Page 49: Embedded Java Research

ProfilesProfiles

MIDP (Mobile Information Device Profile)MIDP (Mobile Information Device Profile) Foundation ProfileFoundation Profile PDAP (Personal Digital Assistant Profile)PDAP (Personal Digital Assistant Profile)

– Extends the CDLC to take advantage of PDA’sExtends the CDLC to take advantage of PDA’s– Currently under development Currently under development

Page 50: Embedded Java Research

Foundation ProfileFoundation Profile

Base profile that other profiles can build Base profile that other profiles can build fromfrom

For devices with network connectivity and For devices with network connectivity and no GUIno GUI

Page 51: Embedded Java Research

MIDPMIDP

Adds user interface, database and Adds user interface, database and networking to the CLDCnetworking to the CLDC

MIDP devices control MIDlets (similar to MIDP devices control MIDlets (similar to applets) through software. applets) through software.

Page 52: Embedded Java Research

Other TechnologiesOther Technologies

JavaTV APIJavaTV API Jini – a Network APIJini – a Network API Java Embedded ServerJava Embedded Server JTAPI – Telephony API, Java Speech, JTAPI – Telephony API, Java Speech,

many othersmany others

Page 53: Embedded Java Research

Major Platforms SupportedMajor Platforms Supported

Operating SystemsOperating Systems– Windows CEWindows CE– LinuxLinux

ProcessorsProcessors– PicoJava – Sun’s Java ProcessorPicoJava – Sun’s Java Processor– StrongArmStrongArm– MIPsMIPs– IntelIntel

Page 54: Embedded Java Research

Java and Embedded LinuxJava and Embedded Linux

Java does I/O by opening files which are the Java does I/O by opening files which are the Linux device drivers (ex: /dev/mem). Java Linux device drivers (ex: /dev/mem). Java can seek in addition to read, write and open.can seek in addition to read, write and open.

Bootstrapping allows Linux to load necessary Bootstrapping allows Linux to load necessary drivers and networking files and start running drivers and networking files and start running the JVM.the JVM.

Standard Linux distributions with networking Standard Linux distributions with networking support require lots of memory.support require lots of memory.

Page 55: Embedded Java Research

Improving PerformanceImproving Performance

Java bytecode programs are typically 10 Java bytecode programs are typically 10 times slower than programs written in C or times slower than programs written in C or C++.C++.

How well the program is written is more How well the program is written is more important. A well-written Java program can important. A well-written Java program can equal the efficiency of an average-written equal the efficiency of an average-written C/C++ program.C/C++ program.

Interpreting code uses less ROM.Interpreting code uses less ROM.

Page 56: Embedded Java Research

Compilation into Native CodeCompilation into Native Code

AOT (Ahead of time) AOT (Ahead of time) JIT (Just in time)JIT (Just in time) Dynamic CompilationDynamic Compilation

Page 57: Embedded Java Research

AOT CompilationAOT Compilation

Similar to C compilersSimilar to C compilers Tends to create large executablesTends to create large executables Need to re-compile for different platforms Need to re-compile for different platforms

or when loading a different classor when loading a different class Can compile everything including class Can compile everything including class

librarieslibraries

Page 58: Embedded Java Research

JIT CompilationJIT Compilation

Machine independentMachine independent Higher startup costHigher startup cost Not ideal for embedded systemsNot ideal for embedded systems

– Requires fast CPU, lots of virtual memory and Requires fast CPU, lots of virtual memory and a fast disk drive for paginga fast disk drive for paging

Page 59: Embedded Java Research

Dynamic CompilationDynamic Compilation

Dynamically compiles code that is being Dynamically compiles code that is being used more frequentlyused more frequently

Typically uses JIT compilersTypically uses JIT compilers Doesn’t require virtual memory, adaptable Doesn’t require virtual memory, adaptable

to available system memoryto available system memory Isn’t guaranteed to meet timing constraintsIsn’t guaranteed to meet timing constraints

– Applications can change the compiler’s thread Applications can change the compiler’s thread priority for greater predictabilitypriority for greater predictability

Page 60: Embedded Java Research

Other Methods to improve Other Methods to improve PerformancePerformance

Static Linking - place bytecode into ROMStatic Linking - place bytecode into ROM Re-write bytecode interpreter in assembly Re-write bytecode interpreter in assembly

languagelanguage Use a Java ChipUse a Java Chip

Page 61: Embedded Java Research

Java ChipsJava Chips

Coprocessors work in tandem with Coprocessors work in tandem with microprocessors. They work similar to microprocessors. They work similar to Graphic accelerators.Graphic accelerators.

Microprocessors that are optimized for JavaMicroprocessors that are optimized for Java– Only programs written in Java can be used.Only programs written in Java can be used.– Contain more registers for stack use Contain more registers for stack use

Page 62: Embedded Java Research

Applications of Embedded JavaApplications of Embedded Java

JVM’s and CompilersJVM’s and Compilers– Embeddable J2EE application server Embeddable J2EE application server

(Macromedia)(Macromedia)– Visual Age Micro Edition (IBM)Visual Age Micro Edition (IBM)– Jbed is a JVM for PDA’s mobile phones and Jbed is a JVM for PDA’s mobile phones and

Internet appliances. Internet appliances. » Has a RTOSHas a RTOS» Runs everything nativelyRuns everything natively» Can use less than 10KB RAMCan use less than 10KB RAM

Page 63: Embedded Java Research

Jbed in detailJbed in detail

Task Objects (sub-class of Java thread)Task Objects (sub-class of Java thread)– Tasks can be executed on a regular interval or Tasks can be executed on a regular interval or

on an interrupton an interrupt– Jbed guarantees a task will meet its deadline if Jbed guarantees a task will meet its deadline if

given its estimated runtime.given its estimated runtime.– Tasks get time-slices and are preempted on a Tasks get time-slices and are preempted on a

timer interrupt. After the task runs for its timer interrupt. After the task runs for its duration, the task with the closest deadline runs. duration, the task with the closest deadline runs.

Page 64: Embedded Java Research

Tasks can only be scheduled after the Tasks can only be scheduled after the minimum time slice (~1ms).minimum time slice (~1ms).

Traditional interrupts preempt threads and Traditional interrupts preempt threads and tasks but may not allow tasks to meet their tasks but may not allow tasks to meet their deadlines.deadlines.

There is functions built into the OS for There is functions built into the OS for memory access. memory access.

Jbed (cont.)Jbed (cont.)

Page 65: Embedded Java Research

Other uses for Embedded JavaOther uses for Embedded Java

BrowsersBrowsers GUIsGUIs Database softwareDatabase software E-mail clientsE-mail clients

Page 66: Embedded Java Research

Conclusions and SummariesConclusions and Summaries

Recent advances in embedded Java technology Recent advances in embedded Java technology and the advent of RTSJ are allowing real-time and the advent of RTSJ are allowing real-time capabilities and possibilities in the Java world.capabilities and possibilities in the Java world.

Many current embedded Java systems are non Many current embedded Java systems are non real-time or a limited subset of RTSJ principles.real-time or a limited subset of RTSJ principles.

Sun’s advancements and broad range of Sun’s advancements and broad range of distribution environments make embedded Java distribution environments make embedded Java programming much simpler and more robust.programming much simpler and more robust.


Recommended