Monday, 29 August 2011

Common Language Runtime (CLR)

The primary function of a runtime is to support and manage the execution of code
targeted for a language or a platform. For example, the Microsoft VC++ requires the
msvcrt60.dll that contains its core support functionality. Even languages like Java have a
run time, in the form of Java Virtual Machine.
The .Net platform also comes with a runtime that is officially called as the Common
Language Runtime or simply the CLR. The CLR is designed to support a variety of
different types of applications, from Web server applications to applications with
traditional rich Windows user interface. Though the role of the CLR is similar to its
counterparts in other languages or platforms, there are some key differences that make it
one of the major features of the .NET platform. Here are the key differences between the
.NET CLR and runtime of other languages:
• It is a common runtime for all languages targeting the .NET platform.
• It acts as an agent that manages code at execution time and also provides core
services such as memory management, thread management and remoting.
• It enforces strict type safety and other forms of code accuracy that ensure security and
• It is responsible for enabling and facilitating the Common Type System. The
Common Type System allows classes that are written in any .NET language to
interoperate with—even inherit from, with overrides—classes written in any
language. So your COBOL.NET program can interoperate with your C#, VB.NET,
Eiffel.NET and with any other .NET language programs.
• It offers a mechanism for cross-language exception handling.
• It provides a more elegant way for resolving the versioning issues (also referred to as
the Dll Hell in our classic COM).
• It provides a simplified model for component interaction.
Code that targets the runtime is known as managed code, while code that does not target
the runtime is known as unmanaged code. Managed code requires a runtime host to start
it. The responsibility of the runtime host is to load the runtime into a process, create the
application domains (we’ll look at this in detail later) within the process, and loads the
user code into the application domains. While we can write our own runtime hosts using
the set of APIs provided by Microsoft, the .NET platform by default ships with runtime
hosts that include the following.

No comments:

Post a Comment