Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Java Virtual Machines

As you well know, the engine behind any Java application (or applet, servlet, etc.) is the JVM.

Once you've compiled your Java source code into a class file(s), and optionally included them in a Java Archive (JAR) file, the JVM translates the class files (more accurately, the byte code in the class files) into machine code for the platform running the JVM. The JVM is also responsible for providing security, allocating and freeing memory and managing threads of execution. It's what makes your Java programs go, so to speak.

For CDC, the virtual machine has the same specification as J2SE. For CLDC, Sun has developed what is referred to as a reference implementation of a virtual machine, known as the K Virtual Machine, or simply KVM. This virtual machine was designed to handle the special considerations of resource-constrained devices. It's clear the KVM is not the "traditional" Java virtual machine:

  • The virtual machine itself requires only 40 and 80 kilobytes of memory

  • Only 20–40 kilobytes of dynamic memory (heap) are required

  • Can run on 16-bit processors clocked at only 25 MHz

The KVM is Sun's implementation of a JVM that fits the guidelines of the CLDC. It is not necessarily the only JVM that is or will be available.

How are the KVM and CLDC Related?

From Sun's documentation: "CLDC is the specification for a 'class' of Java virtual machines that can run on the categories of devices targeted by CLDC and support the profiles." Essentially, the CLDC outlines requirements that must be met by the virtual machine. The KVM is what is known as a reference implementation—it is a virtual machine that meets the CLDC requirements.

  • + Share This
  • 🔖 Save To Your Account