.NETGURU
Application Domains
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.clr.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

rb531 (VIP)
I have a question regarding app domains. I have a Windows Forms .NET
application. If I open two instances of my application, will they get loaded
into two application domains in the same process or two processes will be
created for the two instances?

Thank you,
Reply to this message...
 
    
Patrik Löwendahl [C# MVP] (VIP)
There will be two processes.

Think about it, Windows don't want two appplications to run in the same
process-space, that would cripple both applications if one fail and that's
the basic feature of processes, to not let applications disturb each other
(or the OS).

--
Patrik Löwendahl [C# MVP]
www.cshrp.net - "Elegant code by witty programmers"

"rb531" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Jon Skeet [C# MVP] (VIP)
Patrik Löwendahl [C# MVP] <Click here to reveal e-mail address> wrote:
[Original message clipped]

Well, that's the current situation - but one of the points of
AppDomains is to allow precisely this kind of host sharing. The CLR
should take care of making sure that if one AppDomain goes down, it
doesn't take down the applications running in other ones.

From the description of AppDomain:

<quote>
Represents an application domain, which is an isolated environment
where applications execute.
</quote>

Sounds pretty good to me...

--
Jon Skeet - <Click here to reveal e-mail address>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Reply to this message...
 
    
Mike
Jon Skeet [C# MVP] wrote:
[Original message clipped]

This is only guaranteed if the apps are verifiable. If the app in one
app domain is not - uses interop (or some hand-crafted IL) - it is
possible that it will stomp over memory used by the other app domain and
bring both of them down.

App domains improve the performance of inter-"process" (app domain)
communication but can't in general offer the memory isolation that
native OS processes can.

Just a thought, but there are one or two cases where it's better (wrt.
stability) for apps to not be sharing a CLR instance.

Regards

Mike
Reply to this message...
 
    
Richard Blewett
Well AppDomains are a managed construct so if you walk outside of managed
code or the managed type system of course they aren't going to offer you
isolation. But the same thing happens in Win32 surely, a kernel mode driver
can stomp all over your process's memory if it choses to do so

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

"Mike" <Click here to reveal e-mail address> wrote in message
news:%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Patrik Löwendahl [C# MVP] (VIP)
I agree that this is how the CLR handles application domains since they act
as lightweight processes. Although, at current date, applications still
convey to OS rules which stipulates that when you start an application from
the shell, it will also produce a new process for that application.

But as you say Jon, if we want, we can start a second appdomain in our
application and manually starta a second instance of that application in the
new appdomain.

We should, however, be aware that it's at the process level where the OS
assigns virtual memory adresses. So having two applications in different
domains in the same process, will give those two applications the same
virtual process memory space. (2gb without the 3g support enabled??). The GC
and the CLR will take care of memory isolation in your process, but still
you're limited to that adress space.

--
Patrik Löwendahl [C# MVP]
www.cshrp.net - "Elegant code by witty programmers"

"Jon Skeet [C# MVP]" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
Patrik Löwendahl [C# MVP] <Click here to reveal e-mail address> wrote:
[Original message clipped]

Well, that's the current situation - but one of the points of
AppDomains is to allow precisely this kind of host sharing. The CLR
should take care of making sure that if one AppDomain goes down, it
doesn't take down the applications running in other ones.

From the description of AppDomain:

<quote>
Represents an application domain, which is an isolated environment
where applications execute.
</quote>

Sounds pretty good to me...

--
Jon Skeet - <Click here to reveal e-mail address>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Reply to this message...
 
    
Jon Skeet [C# MVP] (VIP)
Patrik Löwendahl [C# MVP] <Click here to reveal e-mail address> wrote:
[Original message clipped]

Oh certainly - and of course, that'll become less of an issue with 64
bit processors and OSes. I suspect that most applications are more
likely to be limited by physical memory than virtual memory though.

--
Jon Skeet - <Click here to reveal e-mail address>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Reply to this message...
 
    
Patrik Löwendahl [C# MVP] (VIP)
I agree...

--
Patrik Löwendahl [C# MVP]
www.cshrp.net - "Elegant code by witty programmers"

"Jon Skeet [C# MVP]" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
Patrik Löwendahl [C# MVP] <Click here to reveal e-mail address> wrote:
> I agree that this is how the CLR handles application domains since they
act
[Original message clipped]

Oh certainly - and of course, that'll become less of an issue with 64
bit processors and OSes. I suspect that most applications are more
likely to be limited by physical memory than virtual memory though.

--
Jon Skeet - <Click here to reveal e-mail address>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Reply to this message...
 
    
rb531 (VIP)
So, is it two processes or two application domains in the same process if I
create two instances of my windows .net app?

:)

Thank you,

"Patrik Löwendahl [C# MVP]" wrote:

[Original message clipped]

Reply to this message...
 
    
Willy Denoyette [MVP] (VIP)
"rb531" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Two processes.

Willy.

Reply to this message...
 
    
Willy Denoyette [MVP] (VIP)
"Jon Skeet [C# MVP]" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
Patrik Löwendahl [C# MVP] <Click here to reveal e-mail address> wrote:
[Original message clipped]

Well, that's the current situation - but one of the points of
AppDomains is to allow precisely this kind of host sharing. The CLR
should take care of making sure that if one AppDomain goes down, it
doesn't take down the applications running in other ones.

From the description of AppDomain:

<quote>
Represents an application domain, which is an isolated environment
where applications execute.
</quote>

Sounds pretty good to me...

Jon,
This is exactly what ASP.NET host is doing, one single process can host
multiple applications in separate domains.
The current "shell" as no knowledge about application domains so it's up to
the CLR to set-up a domain for the application to run.
If you want to load multiple winforms applications in the same process
space, you will have to set-up the domain and load the applications
yourself, or you have to implement your own hosting process (like asp.net).

Willy.

Reply to this message...
 
 
System.AppDomain




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification