The K Virtual Machine




  • Extends the reach of Java technology into low-end network connected devices
  • Is a key component of the Java 2 Platform, Micro Edition (J2ME technology) environment
  • Is the smallest general purpose Java virtual machine offered by Sun Microsystems, Inc.
  • Offers superior savings in Java memory usage
  • Runs effectively on low power 16 bit or higher processors
  • Offers exceptional Java performance in resource-constrained devices

The Market Need

As we continue into the post-PC era, the market for network-connected devices continues to grow at an enormous rate. While new classes of devices like smart cellular telephones, pagers, and PDAs proliferate, traditional consumer electronics including televisions, VCRs, CD players, and game machines are getting smarter and adding new capabilities. Whether devices are new or more powerful versions of existing products, all are becoming increasingly interconnected over a network.

In the four years since Sun's introduction of the Java platform, Java technology has become the platform of choice for getting work done on the network. With the advent of the PersonalJava, and the EmbeddedJava application environments, and other Java technologies, the benefits of Java technology use were extended into screen phones, set-top boxes, and even into deeply embedded devices. Nevertheless, while Java product offerings like Java 2 soffware and the PersonalJava application environment have enabled the introduction of Java technology into many markets, there has remained an enormous need and opportunity for leveraging Java technology into the rapidly growing market for low-end network devices--devices that are characterized by severe restrictions on processing power and available memory.

In order to provide compelling Java technology solutions for manufacturers building devices across the spectrum--from palmtop to desktop--Sun has introduced the Java 2 Platform, Micro Edition and the K virtual machine.

The Solution --Java 2 Micro Edition and The KVM

The Java 2 Platform, Micro Edition (J2ME technology), is a new Java framework for the deployment and use of Java technology in the post-PC world. The J2ME environment is a very small Java application environment that Sun will provide in configurations suitable for different market segments. Built in to this core platform is the capability to receive not just application code, but libraries that form part of the Java 2 platform itself. In this way a Java 2 ME environment can be dynamically configured to provide the environment the consumer needs to run an application, regardless of whether all the Java technology based libraries necessary to run the application were present on the device when it shipped. Configuration is performed by server software running on the network.

To further enhance the value of the Java 2 ME environment and ensure a thriving community of independent software vendors, Sun will allow industry groups to define Java technology-based profiles specific to their industry. These profiles are collections of Java technology-based APIs, built on top of the J2ME environment, that define a Java technology-based platform suited to an industry or class of device. As the J2ME environment is itself very small, industries have great flexibility in defining only what they need for a class of device so that, for example, a profile targeted at the wireless market and utilizing the K virtual machine (VM) can retain a very small footprint. Furthermore, profiles built on top of the J2ME environment guarantee independent software vendors that consumer devices possess certain minimum capabilities. Nonetheless, if a developer wishes to provide an application that requires more capability than is offered in a profile, the network service provider can provide that capability at run-time utilizing the J2ME environment's ability to configure dynamically.

The foundation of the Java 2 Platform, Micro Edition on devices like cellular telephones, pagers, and small point of sale systems is the K virtual machine.

The K Virtual Machine

A Java virtual machine is the foundation for Java technology, allowing applications written in the Java programming language to be portable across different hardware environments and operating systems. The virtual machine mediates between the application and the underlying platform, converting the application's bytecodes into machine-level code appropriate for the hardware and operating system being used. In addition to governing the execution of an application's bytecodes, the virtual machine handles related tasks such as managing the system's memory, providing security against malicious code, and managing multiple threads of program execution.

In order to meet the market need for a very small footprint Java implementation, the KVM was designed to overcome three key technical challenges: reducing the size of the virtual machine and class libraries themselves, reducing the memory utilized by the virtual machine during execution, and allowing for components of the virtual machine to be configured to suit particular devices (for example, by allowing pluggable garbage collection).

The KVM design team employed a number of strategies in overcoming these technical challenges. One of these strategies was to enable the partitioning of virtual machine capabilities. The team also architected the byte code interpreter and garbage collector to minimize dynamic memory usage, and carefully implemented the virtual machine and libraries to minimize their size (e.g. by rolling Java Native Interface calls into the VM itself).

The results of the careful design and implementation are readily apparent:

  • Reduced VM Size - the K virtual machine is currently only 50-80 K of object code in its standard configuration, depending on target platform and compilation options.
  • Reduced Memory utilization - In addition to the K virtual machine's small object size, it requires only a few tens of kilobytes of dynamic memory to run effectively. Because of the reduced VM size and memory utilization, even with total memory available of only 128K the K virtual machine enables useful Java technology-based applications to run on a device.
  • Performance - the K virtual machine is able to run effectively on 16 bit processors clocked as low as 25 MHz, and can scale smoothly up to much more powerful 32 bit processors.
  • Portability - although implemented in native code for extra performance, the K virtual machine has a highly portable architecture that reduces system dependencies to a minimum. Even multi-threading and garbage collection have been implemented in a completely system-independent manner, enabling speedy porting to any host platform.

For More Information

For more information on the K Virtual Machine and how it can help enable your device, please visit our website here

All information contained in this document is subject to change.

Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
JavaOne Banner
Java 8 banner (182)