Introduction
Before Application Domains existed, every application had process boundaries that isolated applications running on the same computer. Each application is loaded into a separate process having well-defined boundaries, isolating the application from other applications running on the same computer.
The applications are isolated because memory addresses are process-relative. A memory pointer passed from one process to another cannot be used in any meaningful way in the target process. In addition, you cannot make direct calls between two processes. Instead, you must use proxies, which provide a level of indirection.
.NET introduces the concept of Managed Code. Managed code is passed through a verification process before it can be run (unless the administrator has granted permissions to skip the verification). The verification process determines whether the code might attempt to access invalid memory addresses or perform actions that could cause the process in which it is running to fail to operate. Code that passes the verification test is said to be type-safe. The ability to verify code as type-safe enables the common language runtime (CLR) to provide a great level of isolation with process boundaries, at a much lower performance cost.
What is the application domain?
Application domains provide a secure and versatile unit of processing that the CLR can use to provide isolation between applications. It can be thought as a vitural memory to a process and thus can have multiples of such areas within a single process boundary. The absolute benefit this is you can run several application domains in a single process with the same level of isolation that would exist in separate processes, but without incurring the additional overhead of making cross-process calls or switching between processes. The ability to run multiple applications within a single process dramatically increases scalability, say, in cases of servers.
Isolating applications is also important to application security. For example, you can run controls from several Web applications in a single browser process in such a way that the controls cannot access each other's data and resources.
Benefits of Application Domain 1. If one application goes down due to any fault, it cannot affect other applications. Because type-safe code cannot cause memory faults, using application domains ensures that code running in one domain cannot affect other applications in the process.
2. Code of one application in one appdomain can not access code of other application in other appdomain. This is enforced isolation from CLR. The objects across AppDomains can be copied or only accessed through proxies.
3. Individual applications can be unloaded from memory without disturbing other applications in the same process.
4. Permissions granted to the code can be controlled by the application domain in which the code is running.
Summary
In short, Application Domains provide added level of isolation within a process boundaries. This helps us in achieving the better isolation and management of the multiple applications.
|
| Author: Kumar Velu 15 Jul 2008 | Member Level: Diamond Points : 2 |
Additional information about appdomain:
MarshalByRefObject is the base class for objects that communicate across application domain boundaries by exchanging messages using a proxy. Objects that do not inherit from MarshalByRefObject are implicitly marshal by value. When a remote application references a marshal by value object, a copy of the object is passed across application domain boundaries.
|