NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Application Domains

The NGWS runtime provides a lightweight, versatile unit of processing called an application domain. Since the NGWS runtime is type safe, application domains can provide fault tolerance at a much smaller resource cost than with a traditional Win32 process. In fact, multiple application domains can run in a single Win32 process.

Operating systems and runtime environments typically provide some form of isolation between applications running on the system. This isolation is necessary to ensure that code running in one application cannot adversely affect other unrelated applications.

Typically, isolation means

In Windows, this isolation has historically been achieved using process boundaries. A process runs exactly one application and that process scopes the resources that are available for that process to use. For example, memory addresses in Win32 are process relative---a pointer in one process is meaningless in the context of another process.

The NGWS runtime also provides isolation, but there are many scenarios where the process boundary is unnecessarily resource intensive. Additionally, the runtime can rely on the fact that user code is type safe to help provide isolation at a lower cost than process isolation that relies on processes switches or hardware ring transitions. In addition, fault isolation is achieved at this lower cost in resources.

The NGWS runtime relies on the fact that code is type safe and verifiable to provide fault isolation between domains. By relying on the type safe nature of the code, application domains provide fault isolation at a much lower cost than the process isolation used in Win32. Because isolation is based on static type verification, there is no need for hardware ring transitions or process switches.

The NGWS runtime allows multiple applications to be run in a single Win32 process. A construct called an application domain is used to isolate those applications from one another. In many respects, application domains are the NGWS runtime equivalent of a Win32 process.

In the NGWS runtime, one application domain serves one application. An application can have multiple application domains running on its behalf. An application domain is the unit of code loading and unloading. Note that you can have multiple application domains in one process. Each type is loaded into the same application domain as its caller, or a caller can request that a type be loaded into a new application domain. There are no direct calls between objects in different application domains; instead, a proxy is used. Application domains can be debugged independently.