0% found this document useful (0 votes)
12 views2 pages

CLS

The CLR provides a runtime environment that enables applications written in different .NET languages like C#, VB.NET, and F# to interact seamlessly across platforms. Key components of the CLR include the common type system (CTS) which provides common data types, common language specification (CLS) which ensures interoperability, garbage collector (GC) which automatically manages memory, and just-in-time (JIT) compiler which compiles intermediate language code to native machine code.

Uploaded by

dinzd135
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

CLS

The CLR provides a runtime environment that enables applications written in different .NET languages like C#, VB.NET, and F# to interact seamlessly across platforms. Key components of the CLR include the common type system (CTS) which provides common data types, common language specification (CLS) which ensures interoperability, garbage collector (GC) which automatically manages memory, and just-in-time (JIT) compiler which compiles intermediate language code to native machine code.

Uploaded by

dinzd135
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CLR, or Common Language Runtime, is a crucial component of the .

NET framework developed by


Microsoft. It provides a runtime environment for executing and managing applications written in
various languages, such as C#, VB.NET, and F#. The CLR serves as an intermediary between the
operating system and the programming languages, enabling them to interact seamlessly and ensuring
consistent execution across different platforms.
Components of CLR:
 Common type system(CTS)
 Common language speciation(CLS)
 Garbage Collector(GC)
 Just in Time Compiler(JIT)
1. Common type system:
CTS provides guidelines for declaring, using, and managing data types at runtime. It offers cross-
language communication. For example, VB.NET has an integer data type, and C# has an int data type
for managing integers. After compilation, Int32 is used by both data types. So, CTS provides the data
types using managed code. A common type system helps in writing language-independent code.

It provides two categories of Types.

Value Type: A value type stores the data in memory allocated on the stack or inline in a
structure. This category of Type holds the data directory. If one variable's value is copied to
another, both the variables store data independently. It can be of inbuilt-in types, user-defined,
or enumerations types. Built-in types are primitive data types like numeric, Boolean, char, and
date. Users in the source code create user-defined types. An enumeration refers to a set of
enumerated values represented by labels but stored as a numeric type.
Net Common Language Runtime
Reference Type: A Reference type stores a reference to the value of a memory address and is
allocated on the heap. Heap memory is used for dynamic memory allocation. Reference Type
does not hold actual data directly but holds the address of data. Whenever a reference type
object is made, it copies the address and not actual data. Therefore two variables will refer to the
same data. If data of one Reference Type object is changed, the same is reflected for the other
object. Reference types can be self-describing types, pointer types, or interference types. The
self-describing types may be string, array, and class types that store metadata about themselves.

2. Common Language Specification (CLS):


Common Language Specification (CLS) contains a set of rules to be followed by all NET-supported
languages. The common rules make it easy to implement language integration and help in cross-
language inheritance and debugging. Each language supported by NET Framework has its own syntax
rules. But CLS ensures interoperability among applications developed using NET languages.

3. Garbage Collection:
Garbage Collector is a component of CLR that works as an automatic memory manager. It helps
manage memory by automatically allocating memory according to the requirement. It allocates heap
memory to objects. When objects are not in use, it reclaims the memory allocated to them for future
use. It also ensures the safety of objects by not allowing one object to use the content of another
object.
4. Just in Time (JIT) Compiler:
JIT Compiler is an important component of CLR. It converts the MSIL code into native code (i.e.,
machine-specific code). The .NET program is compiled either explicitly or implicitly. The developer or
programmer calls a particular compiler to compile the program in the explicit compilation. In implicit
compilation, the program is compiled twice. The source code is compiled into Microsoft Intermediate
Language (MSIL) during the first compilation process. The MSIL code is converted into native code in
the second compilation process. This process is called JIT compilation. There are three types of JIT
compilers -Pre, Econo, and Normal. Pre JIT Compiler compiles entire MSIL code into native code before
execution. Econo JIT Compiler compiles only those parts of MSIL code required during execution and
removes those parts that are not required anymore. Normal JIT Compiler also compiles only those
parts of MSIL code required during execution but places them in cache for future use. It does not
require recompilations of already used parts as they have been placed in cache memory.

You might also like