Common Language Runtime

Common language runtime :What is application domain?

Common language run time establishes a boundary around objects created within the same application scope. All objects which belong to the same application or website are kept in the memory isolated from the other application so that they do not conflict with each other resulting in corruption of data. For example a variable “x” created in the application “Bank_app” is distinguished from the variable “x”  in the application “Employee_app” .

CLR help isolate objects created in one application from those created in other applications so that run-time behavior is predictable and the variables do not display garbage value ( which is common in C/C++).

Application Domain:

Application domains provide a flexible and secure method of isolating running applications. An application domain provides application security by the common language runtime  to provide isolation between applications. Several processes which need to communicate with each other can be executed in the same process and can be accessed without switching between processes. The ability to run multiple applications within a single process increases server scalability and efficiency of the server. Using application domains ensures that code running in one domain cannot affect other applications in the process.

In the example below an application domain called “MyDomain “ is created and two applications are launched in the same domain .

  • The first application is an employee windows application for adding and retrieval of data from the employee database named “empproj”
  • The second application named “consoleadd”  is a console application which prints the sum of two long integers .Both the applications have been compiled independently and executed before to create an .exe file.

Then with the help of the following C# code an application domain is created and multiple applications are loaded into the same application domain and executed.

using System;

namespace ConsoleApplication1
public class AppDomain1
public static void Main()
Console.WriteLine(“Creating new AppDomain.”);
AppDomain domain = AppDomain.CreateDomain(“MyDomain”);

Console.WriteLine(“Host domain: ” + AppDomain.CurrentDomain.FriendlyName);//prints parent domain name
Console.WriteLine(“child domain: ” + domain.FriendlyName);//prints child domain name
domain.ExecuteAssembly(@”C:\Users\Indrani Sen\Documents\Visual Studio 2008\Projects\Empproj\Empproj\bin\Debug\Empproj.exe”);
domain.ExecuteAssembly(@”C:\Users\Indrani Sen\Documents\Visual Studio 2008\Projects\consoleadd\consoleadd\bin\Debug\consoleadd.exe”);





Application domain

Cross language interoperability

How does a program gets leaded and executed in Dot Net framework?(CLR)

Loading and execution of programs:

It is the responsibility of CLR(Common language Runtime) to load the concerned class containing the source code from the memory and with the help of the respective compiler, compile the source code into an intermediate machine independent language called MSIL(Microsoft intermediate language).

Dot net framework supports working with multiple programming languages (Cross language inter-operabilty); to transform the source code to MSIL.

  • The CLR requires the metadata containing the information of the project concerned to determine which compiler it requires.
  • After the information regarding the compiler is obtained with the aid of Metadata Engine the concerned classes referred by the program are loaded from the Base class Library and linked with the application.
  • The program execution is dynamic with JIT compiler(Just in time) i.e. the classes are instantiated only during run time.
  • The Just in time compiler is responsible for transforming MSIL to machine depended code for executing the program in the target machine.

common language runtime

Dot Net Framework Evolution

Dot Net framework is a software development environment which aids in faster software development with the help of features such as Cross language interoperability, common language runtime, just in time compilation, dynamic coding etc. Dot Net Framework is not a programming language. It is a platform that provides tools and technologies to develop Windows, Web and Enterprise applications .


Evolution of .NET

NET technology was introduced by Microsoft, to catch the market from the SUN Microsystem’s  Java. Java has become an extremely popular language specially for web development and Microsoft had only VC++ and VB to compete with Java . With the world more and more dependent on Internet and java related tools, Microsoft seemed to be losing the battle.VC++ foundation classes were difficult to learn while Visual Basic though popular was too simple for serious applications.Microsoft developed the OLE and the COM technology before Dot Net .


OLE Technology

OLE stands for Object Linking and Embedding which enables one to create objects with one application and then link or embed them in a second application. For example, The Microsoft Excel worksheets can be embedded in a Visual Basic Form or in a PowerPoint presentation such that when the original embedded object changes the change is affected in the linked application. Embedded objects retain their original format and links to the application that created them. This technology enables users develop applications which requires interoperability between various products.

COM Technology

The component oriented model (COM)on the other hand enables to divide a software into independent executable and reusable components .These components can be collected to form a library which can be references in the future projects if required.




What makes COM and OLE unique is that the architecture is based on reusable design and reusable code. One of the fundamental concepts in COM, the interface, is based on the idea of design reuse. COM and OLE introduce a programming model based on reusable designs.

Microsoft started development of the .NET Framework in the late 1990s secretly under the name of Next Generation Windows Services (NGWS) under the direct supervision of Mr.Bill Gates. Sometime in the July 2000, Microsoft announced a whole new software development   framework for Windows called .NET in the Professional Developer Conference (PDC).Microsoft also released PDC version of the software for the developers to test. By late 2000 the first beta versions of .NET 1.0 were released. The first version of .NET Framework was released on 13 February 2002, bringing managed code to Windows NT 4.0, 98, 2000, ME and XP.