You are on page 1of 26

JVM

(J2EE & J2SE) KVM (J2ME)

Well-known Java Virtual Machine.


CVM,

Addresses on vast small devices. Reduces some VM features to fit resource-

constrained devices.

JCVM

(Java Card)

Addresses on smart cards. It has least VM features.

JVM system is an interpreter. Java virtual machine is a software system that translates and execute java byte code.
An instruction set and the meaning of those instructions

the byte codes A binary format the class file format An algorithm to verify the class file

The memory addressing is implemented and controlled by java virtual machine (JVM). Memory addressing mean where the variables are created, objects are stored, and methods are stored in memory. When a java source file is compiled, a class file is generated, which is a collection of Byte codes. Byte codes are portable. These are later changed to native code by JVM. Bytes code are least affected by virus as compared by executable files. If the Byte code is affected, these are recognized by the JVM and not allowed to be executed. Java has built-in support for exception handling. It has built-in support for multithreading application development. There is a built-in support for networking.

Class files

Class loader subsystem

Method Area

Heap

Java Stacks

PC Registers

Native method Stacks

Runtime data areas

Execution Engine

Native method interface

Native method libraries

JVM Architecture

1. Class loader Sub-System performs its task in a sequential way: It loads a class file . It checks the correctness of the class file. If any one has manipulated the class file, then the class file can not be executed. It allocate memory for static variables. It sets the default value of all static variable. It transforms symbolic reference into direct reference. 2. Method Area It is a logical memory component of JVM. This logical section of memory holds the information about classes and interfaces. Static variables are treated as class variables, because they take memory from method area.

Heap When object or array is created, memory is allocated to them from heap. JVM through the use of new operator allocates memory from the heap for an object. The JVM has a demon thread known as Garbage Collector whose task is to free those objects from heap whose reference is not alive in stack. 4. JAVA Stack Method codes are stored inside method area. For execution, a method needs memory because of local variables and the arguments it has taken. This purpose is fulfilled by java stack.

3.

5. Program counter register It keeps track of the sequence of the program. Pc register holds the address of the instructions to be executed next. 6. Native method stack When a java application invokes a native method, that application does not only use java stack but also use the native method stack for the execution of native methods. The libraries required for the execution of native methods are available to the JVM through Java Native Interface. 7. Execution Engine Generate and executes the java byte code. It contains an interpreter and Just In Time compiler.

8.

Java Native interface JNI is used when the programmer has already developed the code in c/ c++ and wishes to make it accessible to java code. JNI never imposes any restriction on JVM. JVM can add support to JNI without affecting other parts of virtual machine. Native methods accesses JVM features by calling JNI functions.

Java Source (*.java)

Java Compiler

Java Byte code (*.class)

Java byte code (moves locally or via web)

Java Platform Linux Win32/NT Hardware Solaris

Java compile-time Environment


Compile-time Environment Compile-time Environment
Class Loader Byte code Verifier Java Class Libraries

Java Source (.java) Java Byte codes move locally or through network

Java Interpreter

Just in Time Compiler

Java C ompiler

Java Virtual machine

Runtime System

Java Byte code (.class )

Operating System

Hardware

Java is platform independent only for the reason: Only depends on the Java Virtual Machine (JVM), code is compiled to byte code, which is interpreted by the resident JVM, JIT (just in time) compilers attempt to increase speed.

To meet the market need for a very small footprint Java implementation, the KVM was designed to overcome three key technical challenges: 1. Reducing the size of the virtual machine and class libraries themselves. 2. Reducing the memory utilized by the virtual machine during execution. 3. Allowing for components of the virtual machine to be configured to suit particular devices (for example, by allowing pluggable garbage collection).

The KVM is the core of the Java 2 Micro Edition (J2ME). J2ME is a new edition of the Java 2 platform targeted at consumer electronics and embedded devices. So named because its size is measured in the tens of kilobytes, the KVM is suitable for 16/32-bit RISC/CISC microcontrollers with a total memory of no more than a few hundred of kilobytes and sometimes less than 128Kbytes of RAM. This typically applies to digital cellular phones, pagers, mainstream personal digital assistants, low-end analog set-top boxes, and small retail

The results of the careful design and implementation are readily apparent: Reduced VM Size - the K virtual machine is currently only 50-80 K of object code in its standard configuration, depending on target platform and compilation options. Reduced Memory utilization - In addition to the K virtual machine's small object size, it requires only a few tens of kilobytes of dynamic memory to run effectively. Because of the reduced VM size and memory utilization, even with total memory available of only 128K the K virtual machine enables useful Java technology-based applications to run on a device.

Performance - the K virtual machine is able to run effectively on 16 bit processors clocked as low as 25 MHz, and can scale smoothly up to much more powerful 32 bit processors. Portability - although implemented in native code for extra performance, the K virtual machine has a highly portable architecture that reduces system dependencies to a minimum. Even multithreading and garbage collection have been implemented in a completely system-independent manner, enabling speedy porting to any host platform.

CDC : Connected Device Configuration CVM is a Java 2 virtual machine designed for devices needing the functionality of the Java 2 virtual machine feature set, but with a smaller footprint. The Connected Device Configuration (CDC) includes the CVM and basic class libraries to support Java language applications on consumer electronic and embedded devices.

CDC

is designed for the devices such as smart communicators, pagers, personal digital assistants (PDAs), and interactive, digital television set-top boxes. these devices run a 32-bit microprocessor/controller and have more than 2.0MB of total memory.

Typically,

JCVM

has least VM features defined in JVM SPEC. Unsupported Features:


Dynamic Class Loading Security Manager Garbage Collection & Finalization Threads Cloning

Unsupported

Keywords:

native synchronized transient volatile


Unsupported

Types:

char, float, double, long Arrays that is more than one dimension.

In

general, none of Java core API classes are supported in the Java Card platform. Some classes from java.lang package are supported, but none of the rest are. Class java.lang.System is not supported. Instead, it supplies a class javacard.framework.JCSystem, which provides an interface to system behavior.

You might also like