What Are AppDomains?

When I talked about Processes earlier, I mentioned that Processes have
physically isolated memory and resources needed to maintain
themselves, and I also mentioned that a Process has at least 1 thread.
Microsoft also introduced 1 extra layer of abstraction/isolation
called an AppDomain. The AppDomain is not a physical isolation, but
rather a logic isolation within the Process. Since more than 1
AppDomain can exist in Process we get some benifits. For example until
we had an AppDomain Processes that needed to access each others data
had to use a Proxy, which introduced extra code and overhead. By using
a AppDomain it is possible to launch several applications within the
same Process. The same sort of isolation that exists with Processes is
also available for AppDomain.Threads can execure across application
domains without the overhead of inter process communication. This is
all encapsulated within the AppDomain class. Any time a namespace is
loaded in an application it is loaded into an AppDomain. The AppDomain
used will be the same as the calling code unless otherwise specified.
AppDomain may or may not contain threads, which is different to
Processes.

No comments:

Post a Comment