JVM Architecture with a diagram

Hello pal,

Most of the java beginners donno what is JVM and how the architecture of it will be i.e., JVM Inside..Lets explore what it is..

What is JVM??

In simple words,

  • Java Virtual Machine is not a real hardware machine but a software layer which resembles an hardware platform.
  • JVM converts java byte code into machine language and executes it
  • The byte code can be executed on any platform where jvm exists.

jvm

JVM Inside(JVM Architecture)

JVM-arc1

1. Class loader sub system: JVM’s class loader sub system performs 3 tasks
a. It loads .class file into memory.
b. It verifies byte code instructions.
c. It allots memory required for the program.

2. Run time data area: This is the memory resource used by JVM and it is divided into 5 parts
a. Method area: Method area stores class code and method code.
b. Heap: Objects are created on heap.
c. Java stacks: Java stacks are the places where the Java methods are executed. A Java stack contains frames. On each frame, a separate method is executed.
d. Program counter registers: The program counter registers store memory address of the instruction to be executed by the micro processor.
e. Native method stacks: The native method stacks are places where native methods (for example, C language programs) are executed. Native method is a function, which is written in another language other than Java.

3. Native method interface: Native method interface is a program that connects native methods libraries (C header files) with JVM for executing native methods.

4. Native method library: holds the native libraries information.

5. Execution engine: Execution engine contains interpreter and JIT compiler, which covert byte code into machine code. JVM uses optimization technique to decide which part to be interpreted and which part to be used with JIT compiler. The HotSpot represent the block of code executed by JIT compiler.

Unfamiliar Facts In Java

Guys this post is not related to you. I hope you are well aware..but i came to know this by today. Hence for reference I am posting 🙂

Java history is interesting to know. Java team members (also known as Green Team), initiated a revolutionary task to develop a language for digital devices such as set-top boxes, televisions etc.

j1

1) James GoslingMike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of sun engineers called Green Team.

2) Originally designed for small, embedded systems in electronic appliances like set-top boxes.

3) Firstly, it was called “Greentalk” by James Gosling and file extension was .gt.

4) After that, it was called Oak and was developed as a part of the Green project.

5) Why Oak? Oak is a symbol of strength and choosen as a national tree of many countries like U.S.A., France, Germany, Romania etc.

6) In 1995, Oak was renamed as “Java” because it was already a trademark by Oak Technologies.

7) Why they choosed java name for java language? The team gathered to choose a new name. The suggested words were “dynamic”, “revolutionary”, “Silk”, “jolt”, “DNA” etc. They wanted something that reflected the essence of the technology: revolutionary, dynamic, lively, cool, unique, and easy to spell and fun to say.

According to James Gosling “Java was one of the top choices along with Silk“. Since java was so unique, most of the team members preferred java.

8) Java is an island of Indonesia where first coffee was produced (called java coffee).

9) Notice that Java is just a name not an acronym.

10) Originally developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995.

Java is secured because:

  • No explicit pointer
  • Programs run inside virtual machine sandbox.

csecurity

  • javasecurity
  • Classloader- adds security by separating the package for the classes of the local file system from those that are imported from network sources.
  • Bytecode Verifier- checks the code fragments for illegal code that can violate access right to objects.
  • Security Manager- determines what resources a class can access such as reading and writing to the local disk.

1)Setting temporary Path of JDK in Windows:

For setting the temporary path of JDK, you need to follow these steps:
  • Open command prompt
  • copy the path of bin folder
  • write in command prompt: set path=copiedpath

For Example:

set path=C:\Program Files\Java\jdk1.6.0_23\bin

JVM

JVM (Java Virtual Machine) is an abstract machine.It is a specification that provides runtime environment in which java bytecode can be executed.
JVMs are available for many hardware and software platforms (i.e.JVM is plateform dependent).
The JVM performs four main tasks:

  • Loads code
  • Verifies code
  • Executes code
  • Provides runtime environment

JRE

JRE is an acronym for Java Runtime Environment.It is used to provide runtime environment.It is the implementation of JVM.It physically exists.It contains set of libraries + other files that JVM uses at runtime.
Implementation of JVMs are also actively released by other companies besides Sun Micro Systems.

jre2

JDK

JDK is an acronym for Java Development Kit.It physically exists.It contains JRE + development tools.

jdk2