[Top] [Prev] [Next] [Bottom]


[Contents] [Index]

Dis Virtual Machine

The Dis virtual machine provides the execution environment for applications.

For simplicity, this section uses the term thread to describe a thread of control created by the Limbo spawn statement. The terms process and OS process are used for Inferno processes and, in a hosted environment, host operating system processes. There are separate schedulers for Inferno processes and Limbo threads.

Memory Organization

Only a single instance of Dis controls the heap. For efficiency of thread context switching, multiple interpreters do not share memory.

All modules and threads share a single data heap. Program module instances and stack frames are allocated from the heap. Each heap object is associated with a type descriptor that contains its size and the location of pointers to other heap objects. Memory location information is transmitted in the form of type descriptors that are generated automatically by the Limbo compiler and the built-in module Loader.

When a new object is allocated, all of its pointers are initialized to nil, a value guaranteed to cause an exception if de-referenced. Memory protection is enforced by cooperation between the compiler and the virtual machine.

Memory is addressed as bytes. Words are stored in the native representation of the host CPU. Data types larger than a byte must be stored at aligned addresses.

Memory for a thread of execution is divided into several separate regions.

Garbage Collection

The garbage collector in the Inferno system is a hybrid scheme that uses two algorithms:

Most memory is collected immediately using a reference counting algorithm. Dis performs reference counted garbage collection to restore resources to availability immediately after last use. Every memory location that stores a pointer is known to the virtual machine and memory can be initialized and deallocated quickly and correctly.

Data structures that are cyclic are detected by the garbage collector running as an independent background process in the virtual machine. Cyclic structures are collected by a real time mark-and-sweep process using a four-color algorithm to ensure efficient deallocation. Since the mark-and-sweep collection only involves cyclic structures, it runs only for small quanta during the idle loop so it has little impact on system performance.

Program Execution

Multiple Limbo threads are placed onto a run queue and executed in round-robin fashion. Threads are multiplexed onto processes; a given thread may be executed by several processes in sequence before it completes, and multiple threads may be attached sequentially to a single process.

Execution continues for a given thread until one of the following conditions is met:

Figure 1-2 Dis Virtual Machine Operation


[Top] [Prev] [Next] [Bottom]

infernosupport@lucent.com
Copyright © 1997, Lucent Technologies, Inc.. All rights reserved.