CLR application domain
Encyclopedia
In Microsoft's Common Language Runtime
(CLR), an application domain is a mechanism (similar to a process
in an operating system
) used to isolate executed software applications from one another so that they do not affect each other. Each application domain has its own virtual address space
which scopes
the resources for the application domain using that address space
.
In this sense, the CLR is like a mini-operating system. It runs a single process that contains a number of sub-processes, or application domains.
The advantage of application domains is that running multiple application domains requires fewer resources, such as memory, than running multiple operating system processes.
via marshalling
by value (unbound objects), marshaling by reference through a proxy (application-domain-bound objects). There is a third type of object called a context-bound object which can be marshalled by reference across domains and also within the context of its own application domain. Because of the verifiable type-safety of managed code
, the CLR can provide fault isolation between domains at a much lower cost than an operating system process can. The static type verification used for isolation does not require the same process switches or hardware ring transitions that an operating system process requires.
Common Language Runtime
The Common Language Runtime is the virtual machine component of Microsoft's .NET framework and is responsible for managing the execution of .NET programs. In a process known as just-in-time compilation, the CLR compiles the intermediate language code known as CIL into the machine instructions...
(CLR), an application domain is a mechanism (similar to a process
Process (computing)
In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system , a process may be made up of multiple threads of execution that execute instructions concurrently.A computer program is a...
in an operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
) used to isolate executed software applications from one another so that they do not affect each other. Each application domain has its own virtual address space
Virtual address space
Virtual address space is a memory mapping mechanism available in modern operating systems such as OpenVMS, UNIX, Linux, and Windows NT...
which scopes
Scope (programming)
In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes. The type of scope determines what kind of entities it can contain and how it affects them—or semantics...
the resources for the application domain using that address space
Address space
In computing, an address space defines a range of discrete addresses, each of which may correspond to a network host, peripheral device, disk sector, a memory cell or other logical or physical entity.- Overview :...
.
Properties
A CLR application domain is contained within an operating system process. A process may contain many application domains. Application domains have isolation properties similar to that of operating system processes:- Multiple threadsThread (computer science)In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...
can exist within a single application domain. - The application in a domain can be stopped without affecting the state of another domain in the same process.
- A fault or exceptionException handlingException handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution....
in one domain does not affect an application in another domain or crash the entire process that hosts the domains. - Configuration information is part of a domain's scope, not the scope of the process.
- Each domain can be assigned different security access levels.
- Code in one domain cannot directly access code in another.
In this sense, the CLR is like a mini-operating system. It runs a single process that contains a number of sub-processes, or application domains.
The advantage of application domains is that running multiple application domains requires fewer resources, such as memory, than running multiple operating system processes.
Inter-domain communications
Direct communication cannot be achieved across application domains. However, application domains can still talk to each other by passing objectsObject (computer science)
In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure...
via marshalling
Marshalling (computer science)
In computer science, marshalling is the process of transforming the memory representation of an object to a data format suitable for storage or transmission...
by value (unbound objects), marshaling by reference through a proxy (application-domain-bound objects). There is a third type of object called a context-bound object which can be marshalled by reference across domains and also within the context of its own application domain. Because of the verifiable type-safety of managed code
Managed code
Managed code is a term coined by Microsoft to identify computer program code that requires and will only execute under the "management" of a Common Language Runtime virtual machine ....
, the CLR can provide fault isolation between domains at a much lower cost than an operating system process can. The static type verification used for isolation does not require the same process switches or hardware ring transitions that an operating system process requires.