Blog is under construction. Blog is under construction.

Wednesday 8 August 2012

Explain about JVM ARchitecture?


How the Java Virtual Machine (JVM) Works?


The Java virtual machine is called "virtual" because it is an abstract computer defined by a specification. To run a Java program, you need a concrete implementation of the abstract specification. This chapter describes primarily the abstract specification of the Java virtual machine. To illustrate the abstract definition of certain features, however, this chapter also discusses various ways in which those features could be implemented.


What is a Java Virtual Machine?
To understand the Java virtual machine you must first be aware that you may be talking about any of three different things when you say "Java virtual machine." You may be speaking of:
  • the abstract specification,
  • a concrete implementation, or
  • a runtime instance.
The abstract specification is a concept, described in detail in the book: The Java Virtual Machine Specification, by Tim Lindholm and Frank Yellin. Concrete implementations, which exist on many platforms and come from many vendors, are either all software or a combination of hardware and software. A runtime instance hosts a single running Java application.
Each Java application runs inside a runtime instance of some concrete implementation of the abstract specification of the Java virtual machine. In this book, the term "Java virtual machine" is used in all three of these senses. Where the intended sense is not clear from the context, one of the terms "specification," "implementation," or "instance" is added to the term "Java virtual machine".



The Architecture of the Java Virtual Machine



1.            The first component of JVM architecture is "class loader" used to load the .class files.
2.            Class Loader object loads user defined .class files from the given userdefined package or from current package by default where as ' boot strap class loader' loads .class files from Java API at runtime.
3.            The loaded .class files is forwarded to 'execution engine'.
4.            'Execution Engine' translates .class files byte code to platform native code and it calls the native functions using native callable statements.
5.            Execution engine contains 2 components. (i) JVM (Interpreter) (ii) JIT(Just In Time)Compiler
6.            JDK contains JVM by default where as web browsers contain JIT. JIT compiles all components at a time. It improves performance. JIT is needed to display downloaded applet file at client browser.
7.            The code which is written in other languages is known as native code(.dll, .cab) to Java. Native code is processed by native translator of JVM.
8.            JVM allocates memory for Java Datatypes at runtime not at compilation time. JVM needs memory to allocate. JVM needs 2MB to 64MB initial memory to execute an application.
9.            Memory is divided into five data areas like Stack Area, Heap Area, Method Area, Register Area and Stackpool Area.

For more information on JVM: 

Watch Video about JVM:


1 comments:

  1. A nice tutorial on
    JVM Architecture Specification Basic The Heap Area Introduction, teach about the JVM Heap Area in details
    http://www.youtube.com/watch?v=c-A7ZzxjWUI

    JVM Architecture Specification Basic The Method Area explained, teach about the JVM method area
    http://www.youtube.com/watch?v=a5GzF2fSSCE

    ReplyDelete