Java Reference
In-Depth Information
Chapter 6. The Java Virtual Machine
We all know that the best things in life are free. In a similar way, the best things in a language
or computing environment are the things that we don't have to think about at all. These are
the things that are intellectually free. By not having to think about them, we free ourselves
to think about other things. The task of programming—especially the task of programming
large, long-lived systems of programs—is hard enough that anything we can use and not think
about is a good thing.
In Java, it is the virtual machine that gives us a huge amount of functionality without requiring
that we give back much, if any, thought. Most of the time, the virtual machine is to the Java
programmer what water is to a fish. It is the environment in which we live, through which we
move, and from which we draw our basic sustenance. But we rarely think about it, and when
we do, it is generally because something about it has gotten in our way, is doing something
unexpected, or we have to figure out how to configure the thing to run faster or better.
Since we as Java programmers think about the virtual machine only when it needs care and
feeding (or when it is getting in our way), we often forget what it is doing for us. But the virtu-
al machine changes the way we have to think about building large systems and has made that
job much easier. So it is fitting that we spend a few pages to step back and think a bit about
the Java virtual machine (hereafter simply the JVM), as understanding what the JVM does for
us is central to understanding much of the power of Java.
The Basics
Virtual machines, and the notion of virtualization in general, are all the rage these days. Whole
companies have been built around particular virtual machines, and there is an array of choices
from vendors and from the open source world for those who want to explore the world of vir-
tual machines.
Most of the virtual machines [ 17 ] that people are paying attention to virtualize at a very low
level. These virtual machines provide a software layer between the raw hardware and the op-
erating system, giving the OS a set of calls that allow that system to boot and interact with the
hardware using a single software interface. Using such virtual machines, a single computer
Search WWH ::

Custom Search