java virtual machine

11
JAVA VIRTUAL MACHINE Dhanith Krishna

Upload: dhanith-krishna

Post on 18-Jul-2015

88 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Java virtual machine

JAVA VIRTUAL MACHINEDhanith Krishna

Page 2: Java virtual machine

Virtual Machines

A virtual machine (VM) is a software-based emulation of a computer.

JVM executes Java byte code

Byte code is one byte op-codes followed by optional parameters

JVM platform is used by Python, Ruby etc

code execution component of the Java platform

Page 3: Java virtual machine

JVM Architecture

•Better Security

•Portability

•Compile Once Run Anywhere

NEED FOR JVM

Page 4: Java virtual machine

IS JVM for JAVA alone ?

• Compilers for other languages based on JVM exists

• Assemblers on JVM

•Erjang

•Rhino

•Free Pascal

•Quercus

•Jython

•NetRexx

•Jruby

•Jacl

Page 5: Java virtual machine

• Loads class to memory

• Verification

• Allocation of static fields

• Linking

• Invocation of initialization codes

• Starting Main as a single thread

• Additional Threads are created using Thread class

How class file works in JVM ?

Page 6: Java virtual machine

JVM Architecture

Page 7: Java virtual machine

Storage Management

Page 8: Java virtual machine

Storage Management

Global Data – Global constant poolContains program constants and symbol table information

Per Thread Data – registers + stack + native stack

Heap – Dynamically allocated memory

Page 9: Java virtual machine

Class File Format

Page 10: Java virtual machine

JVM Instruction Set

•Load and store

•Arithmetic

•Type conversion

•Object creation and manipulation

•Operand stack management (push / pop)

•Control transfer (branching)

•Method invocation and return

•Throwing exceptions

•Monitor-based concurrency

Page 11: Java virtual machine