SunilKumar111

Can any please tell me difference between AppDomain and Process in .Net context. I mean I am reading a book which says AppDomain is the new boundry for application execution and we can have more than one AppDomain in a process. If my application (means exe) is executing in an AppDomain than what is a process in which I can create another appdomain means can execute another exe. The book(Professional C# 2005 Wrox pub) further says AppDomains cannot access object directly in another AppDomain without a proxy (proxy ) but the same book gives an example( that works) in which a AppDomain is created and constructor of a class in another assembly is called(through CreateInstance) it sounds consfusing.

Please help or at least tell me proper forum to ask this question




Re: Visual C# General AppDomain creates confusion

Mayur Tendulkar

Hi,

AppDomain is a logical container allowing multiple assemblies to run within single process but don't allow them to directly access each others resources.

AppDomains give many features just like process such as separate resource and all. But AppDomains are much more efficient than Process.

So, the block will look like...

So, processes host application domains. The bigger picture is...

Operating System ---> Process ---> .Net Fx Runtime ---> AppDomains (one or more) --> Assemblies (one or more)

Yes.. If your application (means exe) is executing in an AppDomain, then in the same process, you can launch another AppDomain or just execute another assembly (i.e. exe) in the same AppDomain.

You can get more information from MCTS (70-536): .Net Framework 2.0 Application Development Foundation book. I think it has enough explaination.

Mayur Tendulkar

Microsoft Student Partner






Re: Visual C# General AppDomain creates confusion

SunilKumar111

Hi Mayur,

Thanks for sparing time. can you please tell me what is a process at the very basic level.

Thanks






Re: Visual C# General AppDomain creates confusion

Mayur Tendulkar

Hi,

When you execute any windows application, windows allocates resources for that application and runs that application within a logical boundry called process. That application is then supposed to run within that boundry and use those specified resources only. If application is crashed or is unable to serve the request we can terminate it by killing the process (i.e. in Task Manager we say end-task).

.Net run-time has provided a further isolation by providing Application Domains. Application Domains run within process and they can have nested application domains. .Net assemblies run within those domains.

Say, if a perticular application is not responding, then you can terminate that specified AppDomain without terminating the whole process. This helps when you are calling code from any third party dll and when that dll stop responding, you can easily unload it, without terminating your whole apploication.

This way, AppDomain provides reliability and security to .Net assemblies.

Mayur Tendulkar

Microsoft Student Partner






Re: Visual C# General AppDomain creates confusion

SunilKumar111

Hi Mayur,

My confusion about AppDomains have started melting.

Thank you very much.

--Sunil