Lecture 32: The Java Virtual Machine. The Java Virtual Machine



Similar documents
- Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

picojava TM : A Hardware Implementation of the Java Virtual Machine

Habanero Extreme Scale Software Research Project

02 B The Java Virtual Machine

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

Tuning WebSphere Application Server ND 7.0. Royal Cyber Inc.

The Java Virtual Machine (JVM) Pat Morin COMP 3002

Under the Hood: The Java Virtual Machine. Lecture 24 CS 2110 Fall 2011

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

General Introduction

Chapter 7D The Java Virtual Machine

Java Programming. Binnur Kurt Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0.

1 The Java Virtual Machine

University of Twente. A simulation of the Java Virtual Machine using graph grammars

Restraining Execution Environments

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Java Interview Questions and Answers

Hardware/Software Co-Design of a Java Virtual Machine

Crash Course in Java

Inside the Java Virtual Machine

CSCI E 98: Managed Environments for the Execution of Programs

Cloud Computing. Up until now

Introduction to Programming

Fachbereich Informatik und Elektrotechnik SunSPOT. Ubiquitous Computing. Ubiquitous Computing, Helmut Dispert

Mobile Application Languages XML, Java, J2ME and JavaCard Lesson 04 Java

Instruction Set Architecture (ISA)

Reach 4 million Unity developers

Stack Allocation. Run-Time Data Structures. Static Structures

Memory management. Announcements. Safe user input. Function pointers. Uses of function pointers. Function pointer example

CSC 8505 Handout : JVM & Jasmin

Tool - 1: Health Center

An Overview of Java. overview-1

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Programming the Android Platform. Logistics

Lecture 1 Introduction to Android

Apache Jakarta Tomcat

The Design of the Inferno Virtual Machine. Introduction

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz

Operating Systems and Networks

Trace-Based and Sample-Based Profiling in Rational Application Developer

IBM SDK, Java Technology Edition Version 1. IBM JVM messages IBM

Using jvmstat and visualgc to Solve Memory Management Problems

Introduction to Java

Garbage Collection in the Java HotSpot Virtual Machine

Performance Improvement In Java Application

HOTPATH VM. An Effective JIT Compiler for Resource-constrained Devices

Real-time Java Processor for Monitoring and Test

WebSphere Architect (Performance and Monitoring) 2011 IBM Corporation

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

Java Virtual Machine, JVM

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

C Compiler Targeting the Java Virtual Machine

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Introduction to Java Applications Pearson Education, Inc. All rights reserved.

Java and Java Virtual Machine Security

Cognos8 Deployment Best Practices for Performance/Scalability. Barnaby Cole Practice Lead, Technical Services

Jonathan Worthington Scarborough Linux User Group

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings:

B M C S O F T W A R E, I N C. BASIC BEST PRACTICES. Ross Cochran Principal SW Consultant

System Structures. Services Interface Structure

Experimental Evaluation of Distributed Middleware with a Virtualized Java Environment

Building Embedded Systems

CSC 551: Web Programming. Spring 2004

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

Performance Tools for Parallel Java Environments

Large-Scale Web Applications

MEASURING WORKLOAD PERFORMANCE IS THE INFRASTRUCTURE A PROBLEM?

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

COS 318: Operating Systems

Replication on Virtual Machines

C# and Other Languages

How to create/avoid memory leak in Java and.net? Venkat Subramaniam

SDFS Overview. By Sam Silverberg

Java Crash Course Part I

Java Card TM Open Platform for Smart Cards

JVM Tool Interface. Michal Pokorný

Online Recruitment System 1. INTRODUCTION

Instrumentation Software Profiling

The Hotspot Java Virtual Machine: Memory and Architecture

Java Troubleshooting and Performance

Tomcat Tuning. Mark Thomas April 2009

Effective Java Programming. measurement as the basis

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc()

Multi-core Programming System Overview

Java and Java Virtual Machine security vulnerabilities and their exploitation techniques

STM32JAVA. Embedded Java Solutions for STM32

J2EE-JAVA SYSTEM MONITORING (Wily introscope)

Optimizing Generation of Object Graphs in Java PathFinder

Development of Java ME

Implementation Aspects of OO-Languages

Java Programming Fundamentals

Performance brief for IBM WebSphere Application Server 7.0 with VMware ESX 4.0 on HP ProLiant DL380 G6 server

Virtual Machines. Case Study: JVM. Virtual Machine, Intermediate Language. JVM Case Study. JVM: Java Byte-Code. JVM: Type System

Programming Language Inter-conversion

Transcription:

The University of North Carolina at Chapel Hill Spring 2002 Lecture 32: The Java Virtual Machine April 12 1 The Java Virtual Machine Java Architecture Java Programming Language Java Virtual Machine (JVM) Java API We will use the JVM as a case study of an intermediate program representation 2 1

Reference The content of this lecture is based on Inside the Java 2 Virtual Machine by Bill Venners Chapter 1Introduction to Java's Architecture» http://www.artima.com/insidejvm/ed2/ch01introtojavasarchitect ureprint.html Chapter 5 The Java Virtual Machine» http://www.artima.com/insidejvm/ed2/ch05javavirtualmachine1. html Interactive Illustrations» http://www.artima.com/insidejvm/applets/index.html 3 The Java Programming Environment 4 2

The Java Platform The byte code generated by the Java front-end is an intermediate form Compact Platform-independent 5 Phases of Compilation 6 3

The Role of the Virtual Machime Local or Remote 7 The Execution Engine Back-end transformation and execution Simple JVM: byte code interpretation Just-in in-time compiler» Method byte codes are compiled into machine code the first time they are invoked» The machine code is cached for subsequent invocation» It requires more memory Adaptive optimization» The interpreter monitors the activity of the program, compiling the heavily used part of the program into machine code» It is much faster than simple interpretation» The memory requirement is only slightly larger due to the 20%/80 80% rule of program execution (In general, 20% of the code is responsible for 80% of the execution) 8 4

The Java Virtual Machine 9 Shared Data Areas 10 5

Thread Data Areas Frame in Execution 11 Stack Frames Stack frames have three parts: Local variables Operand stack Frame data 12 6

Stack Frame Local Variables class Example3a { public static int runclassmethod(int i, long l, float f, double d, Object o, byte b) { return 0; } public int runinstancemethod(char c, double d, short s, boolean b) { return 0; } } 13 Stack Frame Operand Stack Adding 2 numbers iload_0 iload_1 Iadd istore_2 14 7

Execution Model Eternal Math Example http://www.artima.com/insidejvm/applets/eternalmath.htm l 15 Stack Frame Frame Data The stack frame also supports Constant pool resolution Normal method return Exception dispatch 16 8

Stack Frame Frame Allocation in a Heap class Example3c { public static void addandprint() { double result = addtwotypes(1, 88.88); System.out.println println(result) ; } public static double addtwotypes(int i, double d) { return i + d; } } 17 Stack Frame Native Method A simulated stack of the target language (e.g. C) is created for JNI 18 9

The Heap Class instances and array are stores in a single, shared heap Each Java application has its own heap Isolation But a JVM crash will break this isolation JVM heaps always implement garbage collection mechanisms 19 Heap Monolithic Object Representation 20 10

The Heap Splitted Object Representation 21 Example HeapOfFish http://www.artima.com/insidejvm/applets/heapoffish.htm l 22 11

The Heap Memory/Speed Tradeoff 23 The Heap Arrays as Objects 24 12

Reading Assignment Inside the Java 2 Virtual Machine by Bill Venners Ch 1 Ch 5 Illustrations 25 13