Teach Time Encyclopedia - Learn About Our World
Home Page
Teach Time
Featured Topics

United States
by state

CITYology

Academic Disciplines

Historical Timelines

Themed Timelines

Calendars

Reference Tables

Biographies

How-tos



Saturday, July 26, 2008

Java virtual machine

The Java virtual machine or JVM is a virtual machine that runs Java byte code, the code produced by a Java compiler or compilers from other languages which produce this code.

Programs written in Java are compiled into a standardized portable binary format, which typically comes in the form of files with the .class extension. A program may consist of many classes, in which case, every class will be in a different file. The first 4 bytes in hexadecimal of each class must be CA FE BA BE. Class files may be packaged together in a .jar file, with the exact same format as a .zip file, optionally with a few extra special files added.

This binary is then interpreted at runtime by a JVM. The main interpretation loop is described by the following pseudo-code

do {
    fetch an opcode;
    if (operands) fetch operands;
    execute the action for the opcode;
} while (there is more to do);

The JVM has a stack based architecture. Each thread has its own program counter.

The JVM has instructions for the following groups of tasks

  • Load and store
  • Arithmetic
  • Type conversion
  • Object Creation and Manipulation
  • Operand stack management (push / pop)
  • Control transfer (branching)
  • Method invocation and return
  • Throwing exceptions

Each particular operating system needs a JVM specifically for it. These JVMs interprete the byte code semantically the same way. But the actual implementation may be different.

The specification for the JVM is published in book form and HTML and anybody is allowed to write an implementation of it. The preface states:

We intend that this specification should sufficiently document the Java Virtual Machine to make possible compatible clean-room implementations. Sun provides tests which verify the proper operation of implementations of the Java Virtual Machine.

See www.kaffe.org for an example of a group of developers having done this.

See also:

External Link



Internet Hotel Solutions

Site Sponsors
AC Units
Baltimore Harbor
Boot Camp Grads
Bra Size
Burkittsville
College Hotels
Digital Harbor
Free Cell Phones
Golden Hare Travel
Golf Vacations
Golf Courses
Gourmet
Hair Styles
Hippodrome
iWoman
Lesson Plans
Maryland Hotels
MD Genealogy
Minor League Stuff
Motel Site
Ocean City
OC Real Estate
Old Agers
Office Supplies
Orlando
Pet Friendly Hotel
Room Prices
Savannah, GA
Ski Vacations
South Baltimore
Student Teaching
Travel Sources
University Hotels
Visit Military Bases
Washington, DC

Brought to you by NoChildLeftBehind.com and the Beaches and Towns Network, LLC.