Tuesday, May 3, 2011

VIRTUAL MACHINES

Java is both compiled and interpreted. The Java compiler (javac) translates Java source code into Java
“bytecode,” which is a platform-independent intermediate code. When the Java program (java) runs, the Java
Virtual Machine (JVM) interprets the Java bytecode.
A virtual machine such as the Java JVM is a computer defined by software rather than hardware. A virtual
machine runs programs like a real computer, but the virtual machine is really another program, a construction in
software, that fetches, decodes, and executes the program’s instructions. The instructions are referred to as bytecode.
In the case of Java, the JVM implements a machine described by the official JVM specification by
Lindholm and Yellin, which you can view on the Sun Microsystems website: http://java.sun.com/docs/
books/vmspec/.
The Java Virtual Machine is the cornerstone of the Java and Java 2 platforms. It is the component of the technology
responsible for its hardware and operating system independence, the small size of its compiled code, and its ability
to protect users from malicious programs.
The Java Virtual Machine is an abstract computing machine. Like a real computing machine, it has an instruction
set and manipulates various memory areas at run time.
Java is both compiled and interpreted; the source code is compiled into bytecode, and the bytecode is
interpreted by the JVM. Further, many current implementations of the JVM offer just-in-time compilation
(JITC), which means that when the program first executes, the JVM actually compiles the bytecode into
machine instructions. Henceforth, executing the program runs a compiled program in object code form. The
goal of this design is to provide the advantages of both compilers and interpreters.
By the way, the term virtual machine in general describes an additional layer of abstraction between
the user and the hardware, and so computer scientists also use the term to describe software that makes one
type of computer appear to be another. For instance, the Digital Equipment Corporation VAX product line,
running the VMS operating system, was very popular in the 1980s and 1990s, and many programs were
written for that environment. Since those computers are no longer available, some people install virtual machines
(software) to make Linux (http://www.wherry.com/gadgets/retrocomputing/vax-simh.html) or Windows computers
(http://www.dynawell.com/charon-vax/) execute VAX programs and appear to be VAX/VMS computers.
Another use of the term virtual machine is that by IBM, whose VM operating system provides each user
the illusion of having a complete IBM 370 machine for their personal use.

No comments:

Post a Comment