2.4 NLM Applications, Virtual Machines, and Processes

On NetWare, processes, applications, and drivers run as NLM applications. On NetWare 5.1 and later, NLM applications run as virtual machines (VMs). A VM defines a containment within which an application or service can be hosted on multiple processors. The VM supports a multithreaded execution environment in which the threads in the VM share the following system resources:

The VM also provides a multithreaded and multiprocessor programming environment. This section describes the following aspects of VMs:

2.4.1 Containment

Containment is the separation between complex executing entities (such as applications). It protects the entities from each other so that serious mistakes on the part of one entity have no effect upon another.

In most operating systems with a formalized opposition of user and kernel programming environments, containment is clean. Formal interprocess communication (IPC) mechanisms are required when you cross containment boundaries for the purpose of communicating or sharing information between entities. This type of containment is called process-style containment and does not exist in NetWare versions before 5.0.

However, as compared to the process-containment models of UNIX and Windows, NetWare lacks formal containment. An example of containment in NetWare is the NLM whose resource tag collection permits the system to enforce accountability for resources used and not freed. There are resource tags for the threads an NLM creates and for its semaphores, allocated memory, etc.

When an NLM allocates memory but does not free it up, NetWare issues a warning at unload because NetWare tracks memory usage. However, nothing requires a thread to behave as if it were owned by its creating NLM, so the threads that an NLM creates do not need to continue bound to that NLM and its code. If an NLM unloads before freeing all its threads, an abend occurs. Except for user address space (NetWare 5.x and later), containment on NetWare never ensures protection from entities that go awry.

Because NetWare does not enforce containment, you cannot rely on rigid containment and must explicitly manage thread migration (see Thread Migration) when you are entering and exiting foreign services—especially non-LibC NLM applications.

2.4.2 Spawning New VMs

Your application can use any of the following types of functions to start a new virtual machine.

Interface Type

Function

Description

NKS

NXVmSpawn

Starts a new virtual machine with options to define its environment, stdin, stdout, stderr, and type (either attached or detached).

POSIX like

procle procve

Starts a new process with options to define its environment, stdin, stdout, stderr, and type (either attached or detached). It also supports some of the NetWare load options.

NetWare

LoadModule

Starts a new NLM with NetWare specific load options such as loading in protected memory or loading silently without displaying any messages.

The interface you select to spawn a process might depend upon how much control the parent needs over the spawned process. For example, in NKS the parent process can shut down an attached process. At exit, the attached process can join the parent and return an application-defined status code.