Wednesday, August 17, 2011

JVM Tutorials

JVM Tutorials

About This Book

Download and Install Java SE 1.6 Update 2

java.lang.Runtime Class - The JVM Instance

What Is Runtime?

Printing Runtime Basic Information

Running the Garbage Collector Explicitly

Shutting Down or Terminating the JVM Instance

Executing System Commands

Loading Native Libraries

java.lang.System Class - The Operating System

What Is java.lang.System?

Standard Input, Output, and Error Streams

Current Time in Milliseconds and Nanoseconds

Accessing System Environment Variables

Getting and Adding System Properties

ClassLoader Class - Class Loaders

What Is Class Loader?

What Is java.lang.ClassLoader Class?

Accessing the ClassLoader of a Class

JVM "-verbose:class" Option

loadClass() Method - Loading Classes Explicitly

getSystemResource() Method - Finding Files

Class Loading Problem - JAR Hell

Class Class - Class Reflections

What Is java.lang.Class Class?

forName() Method - Loading Classes

Class Reflection and Introspection

Array Class Introspection

Invoking Methods of Class Instances

Sun's JVM - Java HotSpot VM

What Is HotSpot?

Running Java HotSpot Client VM

Running Java HotSpot Server VM

VM Memory Usages on Windows Systems

JRockit JVM 7.0 by BEA Systems

What Is JRockit JVM?

Installing JRockit JVM 7.0

Running JRockit JVM with Management Console

JRockit JVM 8.0 by BEA Systems

Installing JRockit JVM 8.0

Testing with LongWhile.java

Testing with LongSleep.java

Memory Management Rules and Tests

Memory Management General Rules

Java Exception: java.lang.OutOfMemoryError

Garbage Collection Process

Garbage Collection Tests

GCTest.java - Garbage Collection Test Program

GC Test - Constant Memory Requirement

GC Test - Periodical Memory Requirement

GC Test - Releasing Old vs. New Objects

GC Test - JDK 1.4.0 vs. JDK 1.3.1

GC Test - Client vs. Server

GC Test - JDK 1.6.0 vs. JDK 1.4.0

Stack Overflow Tests

Stack Overflow Testing Programs

Comparison - JDK 1.6.0 vs. 1.4.0

Thread Testing Program and Result

Thread Testing Program

Thread Testing Result with JDK 1.6.0

StringBuffer Testing Program and Result

StringBuffer Testing Program

StringBuffer Testing Result with JDK 1.6.0

CDS (Class Data Sharing)

What Is Class Data Sharing?

Regenerating Shared Archive

Startup Time Saving with Restoring Shared Archive

Startup Time Saving with Multiple JVM Processes

Footprint Saving with Restoring Shared Archive

Viewing Shared Memory of JVM Processes

Micro Benchmark Runner and JVM Options

What Is Micro Benchmark?

BenchmarkRunner.java - Benchmark Runner Program

emptyLoop() - The Empty Loop Test Method

"-XX:+PrintCompilation" - Watching JIT Compilation Logs

"-XX:+PrintGC" - Watching GC (Garbage Collection) Logs

"-Xms" and "-Xmx" - Avoiding GC with Large Memory Size

Benchmark Affected by Other Running Applications

"-Xint" - Running in Interpreted-Only Mode

Micro Benchmark Tests on "int" Operations

Revised BenchmarkRunner.java

Hardware, OS and JVM Configurations

"int" Empty Loop: 16 Nanoseconds per Step

"int" Assignment Only: 14 Nanoseconds per Step

"int" Shift and Assignment: 17 Nanoseconds per Step

"int" Add and Assignment: 17 Nanoseconds per Step

"int" Multiply and Assignment: 17 Nanoseconds per Step

"int" Division and Assignment: 19 Nanoseconds per Step

Micro Benchmark Tests on "long" Operations

"long" Empty Loop: 25 Nanoseconds per Step

"long" Assignment Only: 24 Nanoseconds per Step

"long" Shift and Assignment: 30 Nanoseconds per Step

"long" Add and Assignment: 34 Nanoseconds per Step

"long" Multiply and Assignment: 38 Nanoseconds per Step

"long" Division and Assignment: 53 Nanoseconds per Step

Performance Comparisons between "int" and "long"

Micro Benchmark Tests in JIT Compilation Mode

"int" Loops with JIT Compilation

"long" Loops with JIT Compilation

Performance Improvements of JIT Compilation

Micro Benchmark Tests on "float" and "double" Operations

Benchmark Test Methods for "float" Operation

"float" Operations without JIT Compilation

"float" Operations with JIT Compilation

Benchmark Test Methods for "double" Operation

"double" Operations without JIT Compilation

"double" Operations with JIT Compilation

Performance Improvements of JIT Compilation

References

PDF Printing Version

Labels: