Automatic Synchronization
To understand the ways in which .NET can automatically synchronize access to components, you must first understand the relationship that .NET maintains between components, processes, application domains, and contexts. When a .NET application starts, the operating system launches an unmanaged process, which loads the .NET runtime. However, a .NET application can’t execute directly in the unmanaged process. Instead, .NET provides a managed abstraction of the operating-system process in the form of an application domain, or app domain. Because app domains are a logical abstraction, a single unmanaged process can contain more than one app domain (see Figure 8-3). Chapter 10 discusses app domains in detail.
The app domain isn’t the innermost execution scope of a .NET component. .NET provides a level of indirection between components and app domains, in the form of contexts. Contexts enable .NET to provide component services such as thread synchronization to a component. In fact, one definition of a context is that it’s a logical grouping of components, all configured to use the same set of component services.
Figure 8-3. NET app domains and contexts
Every app domain starts with one context, called the default context , and .NET creates new contexts as required.
By default, .NET components aren’t aware that contexts exist. When a client in the app domain creates an ...
Get Programming .NET Components, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.