Topics on KVM Presented By Xiaozhou David Zhu. Topics covered Introduction Java2 Platform Micro...

30
Topics on KVM Presented By Xiaozhou David Zhu

Transcript of Topics on KVM Presented By Xiaozhou David Zhu. Topics covered Introduction Java2 Platform Micro...

Topics on KVM

Presented By

Xiaozhou David Zhu

Topics covered Introduction Java2 Platform Micro Edition CLDC KVM

Introduction Everything will be connected to the

Internet Customizable, Personal Services

By downloading new services and applications from the internet

Currently, interactive games, banking and ticketing applications, as shown in next slide.

Introduction Technology that enables this: Java2

Platform Micro Edition (J2ME) J2ME Configurations and Profiles

Three layers of software built upon the Host Operating System of the device:

JVM Layer Configuration Layer Profile Layer

J2ME J2ME Devices J2ME Building Blocks

Configurations Profiles

J2ME Devices J2ME keeps key features of Java

Technology Built-in consistency: run anywhere,

any time, on any device High-level OOP Portability of code Safe network delivery Upward scalability with J2SE and J2EE

J2ME Device – cont. 2 broad categories of products

Shared, fixed, connected information devices (represented by CDC): Memory budget: 2-16 MB, most often using TCP/IP

Personal, mobile, connected information devices (represented by CLDC): memory budget: about 128KB, low bandwidth, intermittent network connections, often not based on TCP/IP

J2ME Building Blocks Configuration

Defines a minimum platform for a horizontal category or grouping of devices, each with similar requirements on a total memory budget and processing power.

Profile Is layered on top of a configuration. It

addresses the specific demands of a certain vertical device family. It guarantees interoperability within a family or domain.

J2ME Profile Defines Java platforms for specific vertical

markets Consumers would expect useful applications to

be portable within a device family. Portability across different device categories is

not necessarily very important. Example: cell phones, washing machines,

intercommunicating electronic toys, all belong to different device family, even though there might be many different models within each family.

J2ME Profile – cont. Portability requirements profiles

serve Complete toolkit for implementing

applications for a particular kind of device

A profile ma also be created to support a significant, coherent group of applications that might be hosted on several categories of devices.

J2ME Configurations In J2ME, an application is written for a

particular profile, and a profile is based upon or extends a particular configuration. Thus all of the features of a configuration are automatically included in the profile and may be used by applications written for that profile.

A configuration defines a Java platform for a horizontal category or grouping of devices with similar requirements on total memory budget and other hardware capabilities.

J2ME Configurations – cont. A configuration specifies:

Language features supported JVM features supported Basic Java libraries and APIs supported

A configuration is a contract between a profile implementer and a device’s JVM, thus portability is achieved.

J2ME Configurations – cont. To avoid fragmentation, only 2

standard J2ME configurations are defined CLDC

Very closely related to KVM: CLDC is the specification for a “class” of JVM that can run on the categories of devices, and KVM is a particular implementation of a JVM meeting the CLDC specifications.

CDC: shall be a superset of CLDC, as shown in the next slide

CLDC The details of CLDC can be found in the

white paper. I only cover the goals for CLDC: To define a standard Java platform for small,

resource-constrained, connected devices. To allow dynamic delivery of Java

applications and content to those devices. To enable 3rd party application developers to

easily created applications and content tat can be deployed to those devices.

The K Virtual Machine (KVM) KVM is a compact, portable JVM intended

for small, resource-constrained devices such as cell phones, pagers, etc.

The high-level design goal for KVM was to create the smallest possible complete JVM that would maintain all the central aspects of the Java programming language, and that would nevertheless run in a resource-constrained device with only a few tens or hundreds of KB of available memory (hence the name K, for Kilobytes)

KVM – cont. KVM is designed to be:

Small, with a static memory footprint of the VM core in the range 40 to 80 KB

Clean and highly portable Modularand customizable As complete and fast as possible

without sacrificing the other design goals.

KVM – implementation KVM is implemented in C Sun’s KVM can be compiled and

tested on Solaris and Windows, as well as on Palm OS

Has been ported to over 25 devices

KVM – compilation Can built with any C compiler capable of

compiling ANSI-compliant C files, the only non-ANSI feature in the source code is its use of 64-bit integer arithmetic

Compiler supported: Metrowerks CodeWarrior Rel. 6 for Palm Sun DevPro C Compiler 4.2 on Solaris GNU C compiler on Solaris Microsoft VC++ 6.0 Pro on Win 98 and NT4.0

KVM – Porting KVM Code The majority of KVM source code is common to

all implementations. Machine-dependent, platform-specific code is

isolated to small number of files. New or modified versions of these files must

be created for each port. Some runtime functions must be implemented

to provide the necessary interface between KVM and underlying native operating environment: init, finalize, heap allocation/deallocation, fatal error reporting, event handling, current time, etc.

Launching the KVM On desktop: run form the command line On devices with user interface capable of

launching native applications (Palm OS) the KVM code can be configured to run in that fashion

For other devices, KVM code provides a reference implementation of facility called the Java Application Manager (JAM) to serve as an interface between host OS and the VM

KVM – other details Class Loading

From a directory path as well as from a JAR (Java Archive) file

64-bit support Macros are provided that can be redefined to

perform the apporopriate opeartions for compilers that do not support 64-bit integers.

Native Code Any native code called must be linked at

compile time, invoking native method is via native method lookup tables created during build process.

KVM – other details, cont. Event Handling: 4 ways:

Synchronous notification (blocking) Polling in Java code Polling the bytecode interpreter Asynchronous notification

KVM – other details, cont. Classfile verification: use stackmap

Each method in a downloaded Java classfile contains a stackmap attribute, which is added to standard classfile by a pre-verfication” tool that analyzes each method in the classfile.

Typically performed on a server or desktop before the classfile is downloaded to the device.

Faster, lessVM code and DRAM consumption than standard JVM verification step, but with same level of security.

KVM – Java Code Compact JCC, Also known as ROMize Allows Java classes to be linked directly in

the VM, reducing VM startup time considerably. Combine multiple input files Determine an object instance’s layout and size Load only designated class members, discarding

others. JCC tool is written in Java, so is portable to

various development platforms.

Reference White Paper from Sun.com

(http://java.sun.com/products/cldc/wp/KVMwp.pdf)

Some useful links to KVM:(http://webdev.apl.jhu.edu/~rbe/kvm/)which links to several other links.