'; zhtm += ''; zhtm += '

' + pPage + ''; zhtm += '
'; window.popUpWin.document.write(zhtm); window.popUpWin.document.close(); // Johnny Jackson 4/28/98 } //--> Java 1.2 Unleashed -- Ch 52 -- JavaOS

Java 1.2 Unleashed


- 52 -


One of the most exciting new products released by JavaSoft is the JavaOS version 1.0. JavaOS promises to be the operating system of choice for network computers (NCs), Personal Digital Assistants (PDAs), and commercial electronics devices. This chapter looks at JavaOS, describes its architecture, and examines its features.

Why JavaOS?

With Java supported on Windows, Macintosh, Linux, and UNIX platforms, why would JavaSoft create JavaOS? Rather than porting an existing operating system to new hardware and running Java on top of that operating system, the engineers at JavaSoft and Sun decided to create JavaOS as a small, memory-efficient, fast, and highly portable operating system (OS) that provides direct support for the Java runtime environment, windowing system, networking capabilities, and other features of the Java API. The goal of JavaOS is to make Java available on low-powered and low-memory devices, such as NCs and PDAs.

JavaOS 1.0 is currently available for the Intel X86, Sun SPARC, and StrongARM hardware platforms. Of course, JavaOS will also run on the JavaChip family of processors (picoJava, microJava, and UltraJava). These processors are targeted to a range of products including consumer electronics devices (Web phones and PDAs), network computers, and network servers.

JavaOS Features

Besides providing native Java support, JavaOS has a number of features that make it an ideal operating system for intranet applications. Its small memory footprint and efficient use of processing resources make it an ideal OS for running thin-client applications on network computers. Four megabytes of RAM are sufficient to run JavaOS, HotJava, and other common applications. JavaOS is being ported to low-end x86 machines, extending their lives as network computers. It can be burnt into ROM, allowing it to run on PDAs, hand-held PCs, and consumer electronics devices.

The integrated networking support of JavaOS provides the TCP/IP communication capabilities required in an intranet environment. Its remote boot and network login capabilities enable Java applications and support files to be installed on and managed from a central server. This allows system administrators to automatically upgrade client software across the enterprise and to back up client data at periodic intervals. The central management of JavaOS clients enables zero client administration and facilitates enterprise-wide software distribution and management.

The JavaOS windowing system supports the HotJava and HotJava Views user environments, providing users with a full graphical user interface and the capability to browse Web pages, run Java applets, and exchange email. With JavaOS, users are able to log into a network, from any location, and instantly access their personal workspaces.

Finally, because Java supports the complete Java API, any pure Java application will run on JavaOS. This means that new Java applications, such as the Star Office suite, will run on JavaOS as-is. It also means that even small Java platforms, such as PDAs, will be able to take advantage of the mulithreading, memory management, graphics, and networking capabilities of the Java API.

The JavaOS Architecture

JavaOS is organized into platform-dependent and platform-independent code. The platform-dependent code is referred to as the kernel and consists of the microkernel and Java Virtual Machine (JVM). The microkernel provides memory management, interrupt and trap handling, multithreading, DMA, and other low-level operating system functions. The JVM interprets and executes Java byte codes. The purpose of the kernel is to abstract hardware-specific details and provide a platform-neutral interface for the rest of JavaOS.

The platform-independent code of JavaOS is referred to as the Java runtime. The runtime is written in Java, enabling it to be easily ported and upgraded. It consists of device drivers, networking support, a graphics system, a windowing system, and other elements of the Java API. The device drivers support communication with a display monitor, keyboard, mouse, and network interface card. The networking support classes implement the TCP/IP protocol suite using the network device driver. The graphics and windowing systems provide and implement the Abstract Windowing Toolkit (AWT). Other layers support stream I/O and the remaining elements of the Java API.

Figure 52.1 provides an overview of the JavaOS architecture. JavaOS is a layered operating system that may be tailored for a particular application environment. The layers are functionally independent and may be added or omitted to support the needs of the operating environment. For example, a network computer would utilize all layers of JavaOS and add the HotJava browser and HotJava Views application environments. A consumer electronics device, on the other hand, may only require a limited number of JavaOS layers to run custom application software.

FIGURE 52.1. The JavaOS architecture.

The JavaOS Kernel

Because the JavaOS runtime provides many operating system elements, such as device drivers, file I/O, and windowing and networking support, the JavaOS kernel needs only to provide an interface with the underlying hardware and implement the JVM. This enables the kernel to be small, fast, and portable. The following sections cover the functions performed by the kernel.

System Booting

Since JavaOS is intended for a number of different hardware platforms, it must be capable of booting from a variety of sources including disks, ROM, and network devices. The kernel booting software need not provide all booting capabilities on all hardware platforms, but may be individually tailored for a specific hardware implementation.

Memory Management

Different microprocessors provide varying levels of memory management features to allow memory to be allocated and made available to executing programs. Some microprocessors convert real memory addresses into virtual addresses in order to simplify memory access. Others implement memory access controls that prevent conflicts between programs and enhance system security and integrity. The objective of the memory management function of the JavaOS kernel is to remove these hardware details from the concern of the runtime software by providing a common interface for the allocation and deallocation of memory resources. It uses the underlying hardware memory management capabilities to translate physical memory addresses into virtual addresses and manage the allocation of virtual memory units. The kernel memory management software does not require physical-to-virtual address translation hardware. Instead, it utilizes whatever capabilities are provided by the hardware platform and makes up for any shortcomings using software translation.

JavaOS operates in a single virtual address space that it shares with the runtime and application programs. This address space is never seen outside of the JVM, because the Java memory model does not provide access to memory pointers.

Interrupt and Exception Handling

External devices, such as keyboards, mice, disks, and I/O cards, communicate with an operating system by generating interrupts that are handled and processed by the operating system. Software interrupts, referred to as traps, are used in a similar manner by application programs to request services of the OS. Exceptions consist of traps and other OS calls that are used to signal the occurrence of an error or anomalous condition. The interrupt, trap, and exception processing components of the JavaOS kernel utilize the underlying hardware's interrupt vectoring capabilities to assign interrupts, traps, and exceptions to the appropriate handling routines and device drivers.

Timer Management

The system clock and timer devices generate periodic interrupts to the operating system that are used to keep track of the current time, perform thread scheduling, control the operation of device drivers, and provide API timer support. The JavaOS timer management software utilizes the platform-dependent clock and timer hardware to provide these functions.

Direct Memory Access Control

Direct memory access (DMA) is used by high-speed devices, such as disks, to quickly move information in and out of RAM. The DMA support software of the kernel uses the hardware DMA capabilities to communicate with system devices that use DMA. This software provides a hardware-independent DMA interface to device drivers.

Multithreading Support

The multithreading support function of the kernel manages the memory used by executable threads, saves the current context of a thread, schedules the next thread to be executed, and performs context-switching. The multithreading support function interfaces with the memory management, timer management, and other kernel functions in order to implement multithreading capabilities.

File System Access

Low-level kernel file system support is required in environments, such as a network boot environment, where the kernel must interface with foreign file systems prior to the loading of the device drivers of the runtime system.

Native Code Interface

The kernel may provide the capability to interface with native machine code when that code is required to implement OS functions. An example would be an interface to native code that would drive an advanced video card.

Debugging Support

Certain types of software debugging require the capability to step between machine or byte code instructions under hardware control. Many microprocessors support a special debugging mode of execution. The kernel debugging support software utilizes native debugging facilities to accommodate application-level debugging requirements.


The previously discussed kernel components focus on the utilization of the underlying hardware capabilities to support the needs of the JavaOS runtime. The JVM takes .class files in the Java byte code format and executes them using the machine code instructions of the underlying microprocessor. In order to do this, the JVM must synchronize and control the operation of the rest of the kernel functions. It utilizes the memory management function to control the allocation of memory resources in the form of Java objects, the interrupt handling, DMA, and timer management functions to support Java device drivers, the multithreading and timer management functions to support Java threads, and so on. The JVM is the nucleus of the Java kernel. The other kernel functions provide support to the JavaOS runtime under the direction and control of the JVM.

JavaOS Runtime Components

The JavaOS runtime consists of operating system-specific functions that are written in Java. The JavaOS kernel provides a platform-independent JVM interface by removing hardware-specific characteristics from consideration. The runtime provides the platform-independent resources of the Java API to application programs. The components of the Java runtime are covered in the following sections.

Device Drivers

Device drivers are used to enable communication between the operating system and external devices such as display monitors, keyboards, mice, and network interface cards. The availability of device drivers is a critical factor in determining the success or failure of an operating system. How many times have you heard, "I couldn't get Windows NT to work with my sound card," or "The Macintosh doesn't have a driver for that scanner"? The popularity of an operating system and the availability of device drivers are so closely related that it's hard to determine which one causes the other. Operating systems are popular because they support a variety of devices. Device drivers were written for popular operating systems long before they were written for not-so-popular operating systems.

In JavaOS, all device drivers are written in Java (with two minor exceptions, as discussed in the following note). This has advantages and disadvantages. The primary advantage is that device drivers are highly portable. Once a device driver is written for JavaOS, it is highly likely that the device driver will run across all JavaOS hardware implementations.

NOTE: Device drivers require the capability to directly address specific physical memory addresses and to handle device interrupts. The software to implement these capabilities is implemented in C language code and made available via the Memory and Interrupt classes. The Memory class provides direct access to memory addresses. The Interrupt class supports interrupt handling. These classes can only be accessed by registered device drivers.

The disadvantage of using only Java device drivers is that no existing device drivers will work with JavaOS. All device drivers have to be written from scratch. Fortunately, JavaOS is so popular that many device drivers are being written by hardware vendors and third-party software developers.

TCP/IP Networking

One of the strongest features of JavaOS is its support for TCP/IP networking. In fact, JavaOS provides more comprehensive TCP/IP networking support than Windows NT. JavaOS supports the basic IP, TCP, and UDP protocols you learned about in Part VIII, "Network Programming." It also supports the Internet Control Message Protocol used by the Ping command and network management functions, the Dynamic Host Configuration Protocol (DHCP) used to dynamically assign IP addresses, the Reverse Address Resolution Protocol (RARP) used to determine a host's address, the Domain Name Service (DNS) for hostname-to-IP address translation, and the Network Information Service (NIS) to support network login. It also supports the Network File System (NFS) protocol to share files across a network and the Simple Network Management Protocol (SNMP) to manage network clients and servers. Such extensive networking support alone is reason enough to dump your old desktop OS and install JavaOS.

Graphics System

The graphics system of the JavaOS runtime consists of the basic graphics functions required to manage a display monitor and provide the foundation for an AWT implementation. These functions provide the capability to draw and fill geometric objects, render fonts, and control and display cursors. For performance reasons, some of these functions require direct access to physical memory locations and are implemented as native C language methods.

Windowing System

The windowing system of the JavaOS runtime is none other than the AWT. A special Tiny AWT library is used to implement GUI components. The Tiny AWT does not rely on platform-dependent peer classes of the GUI components.

Other API Classes

The Java runtime provides full support for all classes and interfaces of the Java API. This includes stream input and output, applets, math functions, and all of the other goodies found in the core Java API classes.

HotJava and HotJava Views

Although HotJava and HotJava Views are not part of JavaOS, they are a welcome addition to any Java system and provide the graphical desktop environment for running user applications. HotJava is a full-featured Web browser, written entirely in Java. It supports HTML 3.2, FTP downloading, email, and, of course, the execution of Java applets. HotJava Views is a user interface environment referred to by JavaSoft as a webtop. It provides pushbutton access to email, calendaring, Web browsing, and other networked applications. HotJava Views was developed to provide a user interface for network computer users.


In this chapter, you examined the software architecture of JavaOS and looked at its main features. You also learned about the HotJava browser and the HotJava Views user environment. In the next chapter, you'll learn how to interface Java code with code written in other languages.


© Copyright 1998, Macmillan Publishing. All rights reserved.