JAVA VIRTUAL MACHINE
Dhanith Krishna
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
JVM Architecture
•Better Security
•Portability
•Compile Once Run Anywhere
NEED FOR JVM
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
• 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 ?
JVM Architecture
Storage Management
Storage Management
Global Data – Global constant pool
Contains program constants and symbol table information
Per Thread Data – registers + stack + native stack
Heap – Dynamically allocated memory
Class File Format
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
Java virtual machine

Java virtual machine

  • 1.
  • 2.
    Virtual Machines A virtualmachine (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
  • 3.
  • 4.
    IS JVM forJAVA alone ? • Compilers for other languages based on JVM exists • Assemblers on JVM •Erjang •Rhino •Free Pascal •Quercus •Jython •NetRexx •Jruby •Jacl
  • 5.
    • Loads classto 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 ?
  • 6.
  • 7.
  • 8.
    Storage Management Global Data– Global constant pool Contains program constants and symbol table information Per Thread Data – registers + stack + native stack Heap – Dynamically allocated memory
  • 9.
  • 10.
    JVM Instruction Set •Loadand 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