Micro JVM Kernel

Preemptive Real-time O/S

MJVMK is a lightweight multi-tasking real-time micro kernel for embedded platforms. It has an optional add-on which is a java micro-edition CLDC virtual machine. MJVMK has a very small footprint.

Any combination of native and java applications can be executed by the system, allowing system-critical tasks to be written in native code if required, running seamlessly with generically written java-based tasks.

The programming of the micro-operating system can more easily be changed through the use of the JVM.

Characteristics

The MJVMK is small, efficient and fully self contained, easily portable to an embedded system.

The operating system possesses a dual-purpose heap, one that allows for explicit memory release as well as exact garbage collection. Semaphores provide mutual exlusion and synchronization. Monitors with conditional variables provide for mutual exclusion, synchronization, and wait lists with notification and timeouts. Priority-based scheduling and weighted time-sharing allow for explicit control of processor use and interrupt handling. The kernel is flexibly designed for the addition of required interrupt drivers. Threads/tasks may be run at 64 different priorities, with any number of threads running at a specific priority, and with tasks at specific priorities garnering a configurable and variable amount of CPU time with respect to the other tasks at the same priority.

Java Capability

With the CLDC java virtual machine, MJVMK can run java byte-code on an embedded microprocessor, since the operating system provides all the support required for the Java language, such as the java threading model and garbage collection. The JVM is fine-tuned for embedded platforms by providing such features as a process model (multiple applications in the same virtual machine with entirely separate memory spaces), Java stacks that are optionally fixed-length or growable, romizing support and other performance optimizations.

Further details regarding java support

Several Possible Configurations

Even when running the java virtual machine, tasks running on the O/S may run inside the kernel, entirely separate from the virtual machine, making use of the kernel's API for synchronization, thread management, memory management and other functions. Alternatively, applications may be written in java, making use of the CLDC API. The two application models may be mixed as desired for optimal use of the platform's resources.


A typical configuration for MJVMK

The JVM has an additional built-in scheduler that allows it to run on top of an existing operating system much like a standard JVM. This can be especially useful for debugging purposes.

Small Size

The system has been designed to be extremely compact.

The system has been ported to the protected mode of the Intel x86 compatible group of processors and tested on PCs running the AMD-K6-2 processor and the Intel Pentium processor. The total size of this build with all OS and VM features listed in the description and specification can be broken down as follows:

Operating system internals (boot-up, initialization, kernel, heap, other): 45 KB
CLDC VM internals: 80 KB
CLDC VM class files (non-compressed): 99 KB
Total size: 224 KB

Removing unwanted features can further reduce the size of such a build.

Requirements for a Port

MJVMK is written in highly portable ANSI C. All processor-specific source code listed below is grouped to make porting as straightforward as possible. No external libraries are required.

The interface to the java CLDC virtual machine is written in Java and can be compiled with any standard Java compiler.

A port of the system requires:

• A C compiler that generates reentrant code - code that can be executed by more than one task/thread without fear of corruption
• Interrupts can be explicitly enabled and disabled
• The processor has a clock tick interrupt that occurs at regular intervals
• The processor supports a hardware stack that can accommodate numerous stack frames
• The processor has instructions that allow for loading and storing the stack pointer and other thread-specific CPU registers

The following limited amount of code must be written to complete a port to a specific processor:

• Any platform specific initialization
• Configuring the tick interrupt and the tick rate
• A register swap function for thread switches
• The java standard output and standard error streams (optional but recommended)

For the x86 protected mode port, the above consisted of:

• An x86 boot-loader
• About 300 lines of code for CPU initialization which included enabling address line 20, starting the protected mode, initializing the heap and stack, and initializing the interrupt table
• About 100 additional lines of code for the streams, clock tick and context switching, comprising approximately 4 percent of the compiled operating system