maurices5000 0 Newbie Poster

I'm just trying to get a bit more understanding about what seems to be to me a contradiction in the C# Pro book i bought.

The book says

In simple terms,** a process is a running program**. However, formally speaking, a process is an operating system level concept used to describe a set of resources (such as external code libraries and the primary thread) and the necessary memory allocations used by a running application. For each *.exe loaded into memory, the OS creates a separate and isolated process for use during its lifetime.

Using this approach to application isolation, the result is a much more robust and stable runtime environment, given that the failure of one process does not affect the functioning of another. Furthermore, data in one process cannot be directly accessed by another process, unless you make use of a distributed computing programming API such as Windows Communication Foundation. Given these points, you can regard the process as a fixed, safe boundary for a running application.

Troelsen, Andrew (2010-05-14). Pro C# 2010 and the .NET 4 Platform, Fifth Edition (Kindle Locations 8535-8541). Apress - A. Kindle Edition.

It appears to me from these statements that a process is created for each application that is running. Thus EACH process contains only one application.

However, under Application Domains in the same chapter it says:

Under the .NET platform, executables are not hosted directly within a Windows process, as is the case in traditional unmanaged applications. Rather, a .NET executable is hosted by a logical partition within a process termed an application domain. As you will see, a single process may contain multiple application domains, each of which is hosting a .NET executable.

Troelsen, Andrew (2010-05-14). Pro C# 2010 and the .NET 4 Platform, Fifth Edition (Kindle Locations 8662-8664). Apress - A. Kindle Edition.

As mentioned, a single process can host any number of AppDomains, each of which is fully and completely isolated from other AppDomains within this process (or any other process). Given this fact, be very aware that an application running in one AppDomain is unable to obtain data of any kind (global variables or static fields) within another AppDomain unless they make use of a distributed programming protocol (such as Windows Communication Foundation).

Troelsen, Andrew (2010-05-14). Pro C# 2010 and the .NET 4 Platform, Fifth Edition (Kindle Locations 8671-8674). Apress - A. Kindle Edition.

So here it says that with AppDomain, a process can contain many AppDomains and an AppDomain can contain many executables. Thus a process CAN contain more then one executable for managed executables! I'm assuming that this is an EXCEPTION to the rule in the first quote. When it says executables, which i place in BOLD, he must mean .NET executables.

Conclusion:
Thus unmanaged executables are contained within a single process and manged executables are contained within an AppDomain. There can be multiple AppDomains in a Process unlike the situation with unmanged executables.

Is my conclusion correct?

Sorry if this seems obvious but the way it was introduced, it didn't seem so obvious to me and from experience, i've learned its easy to draw the WRONG conclusions.

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.