Monday 28 September 2015

JVM

Java Virtual Machine

History

Basics

Data Types

JVM Runtimes


History:

  •     Java platform was initially developed to address the problem of building s/w for n/w consumer devices.
  •     To meet requirements , compiled code has to transport across the networks ,works on any client and assure that the client that it was safe to run.
  •     WWW got popularized , but web HTML format was too limited . So the answer is extensibility in the way of HOTJAVA BROWSER.


  •     Hot Java Browser implements the java language and platform embedded into HTML webpages.Like HTML pages , compiled programs are n/w and host independent. The programs works the same way regardless of what machine they run on and where they come from.   

Basics-JVM:

  •     Cornerstone of the Java platform.
  •     is an abstract computing machine . It has its own instruction set and manipulates memory at runtime.
  •     Component of technology responsible for its h/w and os independence , a small class file of compiled code and ability to protect users from malicious programs
  •     Knows nothing of Java programming language only a binary format ie.., class file format. Class file format consists of
    JVM instructions (Byte code )

    Symbol table (key - value pair)

    Ancillary informations(Support info)

  •     Class file format is H/w and Os independent binary format   

Data Types:        

  •     VM operates on 2 kinds of Data Types
     1.Primitive types 2. Reference Types (class types , array types & interface types).
  •     These are the values actually that can be stored in a variable , passed as an argument and a value returned by methods.
  •     Jvm expects all type checking is done prior to the runtime , typically by a compiler .
  •     Explicit support for objects. An object is either dynamically allocated class instance or an array.
  •      reference to an object is considered to have a JVM reference types.
  •     Values of type references can be thought of as a pointer to objects. More than one pointers for an object can exist. Objects are operated via type references.

JVM Runime Areas:




 


PC Register:

  •     Each Jvm Thread has its own PC register
  •     Contains current executing method    
  •     Pc register holds any one of the follwing values
                   if method is not native , PC holds address of JVM instruction

                     if method is native , PC hold either undefined or return addresses(pointer to OPCODES of jvm)

JVM Stacks:

  •     Per thread
  •     Stores frames(data , partial results , dynamic linking,return method values , dispatch exceptions)
  •     Contains local variables , partial results and plays part in method invocation and return  

Heap:

  •     Common for all java threads
  •     Memory for all class instances and arrays are allocated
  •     Created on JVM startup
  •     Heap storage for objects is reclaimed by automatic management system(gc) , objects are never explicitly deallocated
  •     If your computation requires more memory than heap , then OUTOFMEMORYERROR

Method Area:

  •     Common to all Threads
  •     Contains per-class structures , runtime constant pool , field , method data , code for constructors & methods , instances and interface initialization
  •     Logically is a part of heap
  •     VM doesnot mandate location of method area or policies used to manage compiled code  

Run Time Constant Pool:

  •     Per Class/per Interface representation in .Class file
  •     Contains constants , ranging from numeric literals known at compile time to method/fields resolved at runtime
  •     Simillar to symbol table
  •     Allocated from the method area
  •     Pool for class/interface is constructed when class/interface is created by JVM

Native Method Stacks:

  •     Thread based not JVM based
  •     Stacks which assists in interpreting the language other than Java
  •     JVM cannot load native method stacks

                                                        


   





   





   

   

   

    







   

       

        

   





   

   

0 comments:

Post a Comment