G.M.Upadhyay
-
Upload
govind-upadhyay -
Category
Documents
-
view
219 -
download
0
Transcript of G.M.Upadhyay
-
8/3/2019 G.M.Upadhyay
1/26
-
8/3/2019 G.M.Upadhyay
2/26
JVM (J2EE & J2SE) Well-known Java Virtual Machine.
CVM, KVM (J2ME) 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.
-
8/3/2019 G.M.Upadhyay
3/26
-
8/3/2019 G.M.Upadhyay
4/26
-
8/3/2019 G.M.Upadhyay
5/26
JVM system is an interpreter.
Java virtual machine is a software system thattranslates 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 verifythe class file
-
8/3/2019 G.M.Upadhyay
6/26
The memory addressing is implemented andcontrolled by java virtual machine (JVM).
Memory addressing mean where the
variables are created, objects are stored, andmethods are stored in memory. When a java source file is compiled, a class
file is generated, which is a collection of Bytecodes. Byte codes are portable. These arelater changed to native code by JVM.
Bytes code are least affected by virus ascompared by executable files. If the Bytecode 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.
-
8/3/2019 G.M.Upadhyay
7/26
MethodArea
Heap JavaStacks
PCRegisters
Native
methodStacks
Execution Engine
Class loadersubsystem
Native method interfaceNativemethodlibraries
Class files
Runtime data areas
JVM Architecture
-
8/3/2019 G.M.Upadhyay
8/26
1. Class loader Sub-System performs its task in asequential way:
It loads a class file .
It checks the correctness of the class file. If any onehas manipulated the class file, then the class filecan 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.
-
8/3/2019 G.M.Upadhyay
9/26
3. Heap When object or array is created, memory is
allocated to them from heap.
JVM through the use of new operator allocatesmemory from the heap for an object.
The JVM has a demon thread known as Garbage
Collector whose task is to free those objects fromheap whose reference is not alive in stack.
4. JAVA Stack
Method codes are stored inside method area.
For execution, a method needs memory becauseof local variables and the arguments it has taken.
This purpose is fulfilled by java stack.
-
8/3/2019 G.M.Upadhyay
10/26
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 theexecution of native methods.The libraries required for the execution of native
methods are available to the JVM through JavaNative Interface.
7. Execution Engine Generate and executes the java byte code. It contains an interpreter and Just In Time
compiler.
-
8/3/2019 G.M.Upadhyay
11/26
8. Java Native interface
JNI is used when the programmer has already
developed the code in c/ c++ and wishes tomake 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.
-
8/3/2019 G.M.Upadhyay
12/26Hardware
Win32/NTLinux Solaris
Java Platform
Java
Source
(*.java)
Java CompilerJava Byte
code
(*.class)
Java byte code
(moves locally or via web)
-
8/3/2019 G.M.Upadhyay
13/26
Compile-time Environmentompile-timeEnvironment
JavaByte codesmove locallyor throughnetwork
JavaSource(.java)
JavaCompiler
JavaBytecode(.class )
JavaInterpreterJust inTimeCompiler
Runtime System
ClassLoaderByte codeVerifier
JavaClassLibraries
Operating System
Hardware
JavaVirtualmachine
Java compile-time Environment
-
8/3/2019 G.M.Upadhyay
14/26
Java is platform independent only for thereason:
Only depends on the Java Virtual Machine(JVM),
code is compiled to byte code, which isinterpreted by the resident JVM,
JIT (just in time) compilers attempt toincrease speed.
-
8/3/2019 G.M.Upadhyay
15/26
To meet the market need for a very small footprintJava implementation, the KVM was designed to
overcome three key technical challenges:
1. Reducing the size of the virtual machine andclass libraries themselves.
2. Reducing the memory utilized by the virtualmachine during execution.
3. Allowing for components of the virtual machineto be configured to suit particular devices (forexample, by allowing pluggable garbagecollection).
-
8/3/2019 G.M.Upadhyay
16/26
The KVM is the core of the Java 2 Micro Edition(J2ME). J2ME is a new edition of the Java 2platform targeted at consumer electronics and
embedded devices. So named because its size is measured in the tensof kilobytes, the KVM is suitable for 16/32-bitRISC/CISC microcontrollers with a total memory ofno 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
-
8/3/2019 G.M.Upadhyay
17/26
The results of the careful design andimplementation are readily apparent:
Reduced VM Size - the K virtual machine iscurrently only 50-80 K of object code in its standard
configuration, depending on target platform andcompilation options.
Reduced Memory utilization - In addition to theK virtual machine's small object size, it requiresonly a few tens of kilobytes of dynamic memory to
run effectively. Because of the reduced VM size andmemory utilization, even with total memoryavailable of only 128K the K virtual machineenables useful Java technology-based applicationsto run on a device.
-
8/3/2019 G.M.Upadhyay
18/26
Performance - the K virtual machine is able torun effectively on 16 bit processors clocked as lowas 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 machinehas a highly portable architecture that reduces
system dependencies to a minimum. Even multi-threading and garbage collection have beenimplemented in a completely system-independentmanner, enabling speedy porting to any hostplatform.
-
8/3/2019 G.M.Upadhyay
19/26
CDC : Connected Device Configuration
CVM is a Java 2 virtual machine designed
for devices needing the functionality ofthe Java 2 virtual machine feature set, butwith a smaller footprint.
The Connected Device Configuration
(CDC) includes the CVM and basic classlibraries to support Java languageapplications on consumer electronic andembedded devices.
-
8/3/2019 G.M.Upadhyay
20/26
CDC is designed for the devices such assmart communicators, pagers, personal
digital assistants (PDAs), andinteractive, digital television set-topboxes.
Typically, these devices run a 32-bitmicroprocessor/controller and havemore than 2.0MB of total memory.
-
8/3/2019 G.M.Upadhyay
21/26
-
8/3/2019 G.M.Upadhyay
22/26
-
8/3/2019 G.M.Upadhyay
23/26
JCVM has least VM features defined inJVM SPEC.
Unsupported Features: Dynamic Class Loading
Security Manager
Garbage Collection & Finalization
Threads
Cloning
-
8/3/2019 G.M.Upadhyay
24/26
Unsupported Keywords:
native
synchronized transient
volatile
Unsupported Types:
char, float, double, long
Arrays that is more than one dimension.
-
8/3/2019 G.M.Upadhyay
25/26
In general, none of Java core API classesare supported in the Java Card platform.
Some classes from java.lang packageare supported, but none of the rest are.
Class java.lang.System is not
supported. Instead, it supplies a classjavacard.framework.JCSystem, whichprovides an interface to systembehavior.
-
8/3/2019 G.M.Upadhyay
26/26