jvm

Post on 22-May-2015

154 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Understanding Java Virtual Machine

TRANSCRIPT

Java Virtual Machine

2

What do you mean by

JVM?

The abstract specification

A concrete implementation

A runtime instance

What is a Java Virtual Machine?

JVM Overview

3

JVM Structure

JVM Overview

4

JVM Architecture

JVM Architecture

5

Class Loader

Class Loader

6

Class Loader Cont..

Class Loader

7

Java Memory Area

Memory Management

8

Java Memory Area Cont..

Memory Management

9

PC Register

Each thread of a running program has its own PC register

PC register is created when the thread is started

As a thread executes a Java method, PC register containsthe instruction currently being executed by the thread

Memory Management

Keeps track of the current instruction executing at any moment

10

JVM Stack

Stack frame: One stack frame is created whenever a method is executed in the JVM, and the stack frame is added to the JVM stack of the thread

Local variable: The parameters sent to the method are saved. After the method parameters, the local variables of the method are saved

Memory Management

Operand stack: An actual workspace of a method. Each method exchanges data between the Operand stack and the local variable array, and pushes or pops other method invoke results

11

Native method stack

In other words, it is a stack used to execute C/C++ codes invoked through JNI

According to the language, a C stack or C++ stack is created

Memory Management

Stack for native code written in a language other than Java

12

Heap

Memory Management

13

Heap

Memory Management

14

Execution Engine

Interpreter: Reads, interprets and executes the bytecode instructions one by one.

JVM Execution engine

JIT compiler: The execution engine runs as an interpreter first, and at the appropriate time, the JIT compiler compiles the entire byte code to change it to native code

15

Execution Engine - JIT Compiler

JVM Execution engine

JIT compiler: The execution engine runs as an interpreter first, and at the appropriate tie, the JIT compiler compiles the entire byte code to change it to native code

Questions ???

top related