You are on page 1of 7

T.Y.B.Sc(I.T.

)-Advanced Web Programming 2020-2021

.NET Framework

 The .NET Framework is a new and revolutionary platform created by Microsoft for
developing applications platform for application developers.
 It is a framework that supports Multiple Language and Cross language integration.
 It has IDE (Integrated Development Environment).
 Framework is a set of utilities or can say building blocks of your application system.
 .NET Framework provides GUI in a GUI manner.
 .NET is a platform independent
 .NET Framework provides interoperability between languages i.e. Common Type
System (CTS)
 .NET Framework also includes the .NET Common Language Runtime (CLR), which is
responsible for maintaining the execution of all applications developed using the .NET
library.

Compiled By Swarupa P.Gogate


T.Y.B.Sc(I.T.)-Advanced Web Programming 2020-2021

 The .NET Framework consists primarily of a gigantic library of code

Definition: - A programming infrastructure created by Microsoft for building, deploying, and


running applications and services that use .NET technologies, such as desktop applications and
Web services.

Features of the Common Language Runtime:-

1. The common language runtime manages memory, thread execution, code


execution, code safety verification, compilation, and other system services.
2. With regards to security, managed components are awarded varying degrees of trust,
depending on a number of factors that include their origin (such as the Internet,
enterprise network, or local computer). This means that a managed component might or
might not be able to perform file-access operations, registry-access operations, or other
sensitive functions, even if it is being used in the same active application.
3. The runtime enforces code access security. For example, users can trust that an
executable embedded in a Web page can play an animation on screen or sing a song, but
cannot access their personal data, file system, or network.
4. The runtime also enforces code robustness by implementing a strict type-and-code-
verification infrastructure called the common type system (CTS). The CTS ensures that
all managed code is self-describing. The various Microsoft and third-party language
compilers generate managed code that conforms to the CTS. This means that managed
code can consume other managed types and instances, while strictly enforcing type
fidelity and type safety.
5. In addition, the managed environment of the runtime eliminates many common
software issues. For example, the runtime automatically handles object layout and
manages references to objects, releasing them when they are no longer being used. This
automatic memory management resolves the two most common application errors,
memory leaks and invalid memory references.
6. The runtime also accelerates developer productivity. For example, programmers can
write applications in their development language of choice, yet take full advantage of
the runtime, the class library, and components written in other languages by other
developers. Any compiler vendor who chooses to target the runtime can do so.
Language compilers that target the .NET Framework make the features of the .NET
Framework available to existing code written in that language, greatly easing the
migration process for existing applications.
7. Interoperability between managed and unmanaged code enables developers to
continue to use necessary COM components and DLLs.
8. The runtime is designed to enhance performance. Although the common language
runtime provides many standard runtime services, managed code is never interpreted. A
feature called just-in-time (JIT) compiling enables all managed code to run in the native
machine language of the system on which it is executing.

Compiled By Swarupa P.Gogate


T.Y.B.Sc(I.T.)-Advanced Web Programming 2020-2021

The above illustration shows the relationship of the common language runtime and the class
library to your applications and to the overall system. The illustration also shows how
managed code operates within a larger architecture.

JIT – Just In Time

 Just - in - Time (JIT) compiler, this compiles MSIL into native code that is specific
to the OS and machine architecture being targeted.
 Only at this point can the OS execute the application. The just - in - time part of the
name reflects the fact that MSIL code is only compiled as, and when, it is needed.

Garbage Collector:-

The .NET Framework's garbage collector manages the allocation and release of memory for
your application.
Each time you create a new object, the common language runtime allocates memory for the
object from the managed heap. As long as address space is available in the managed heap, the
runtime continues to allocate space for new objects.

Compiled By Swarupa P.Gogate


T.Y.B.Sc(I.T.)-Advanced Web Programming 2020-2021

However, memory is not infinite. Eventually the garbage collector must perform a collection in
order to free some memory.
The garbage collector's optimizing engine determines the best time to perform a collection,
based upon the allocations being made.
When the garbage collector performs a collection, it checks for objects in the managed heap
that are no longer being used by the application and performs the necessary operations to
reclaim their memory.

Conditions for Garbage Collection:

Garbage collection occurs when one of the following conditions is true:

 The system has low physical memory.


 The memory that is used by allocated objects on the managed heap surpasses an
acceptable threshold. This threshold is continuously adjusted as the process runs.
 The GC.Collect method is called. In almost all cases, you do not have to call this
method, because the garbage collector runs continuously. This method is primarily used
for unique situations and testing.

GC.Collect Method ():-

1. Forces an immediate garbage collection of all generations.


2. Namespace: System
3. Assembly: mscorlib (in mscorlib.dll)

Syntax

Public static void Collect()

Use this method to try to reclaim all memory that is inaccessible. It performs a blocking
garbage collection of all generations. All objects, regardless of how long they have been in
memory, are considered for collection; however, objects that are referenced in managed code
are not collected. Use this method to force the system to try to reclaim the maximum amount of
available memory.

Compiled By Swarupa P.Gogate


T.Y.B.Sc(I.T.)-Advanced Web Programming 2020-2021

Managed Code

 The resource, which is within your application domain is, managed code. The resources
that are within domain are faster.
 The code, which is developed in .NET framework, is known as managed code. This code
is directly executed by CLR with help of managed code execution. Any language that is
written in .NET Framework is managed code.
 Managed code uses CLR which in turns looks after your applications by managing
memory, handling security, allowing cross - language debugging, and so on.

Compiled By Swarupa P.Gogate


T.Y.B.Sc(I.T.)-Advanced Web Programming 2020-2021

Unmanaged Code:-

 The code, which is developed outside .NET, Framework is known as unmanaged code.
 Applications that do not run under the control of the CLR are said to be unmanaged,
and certain languages such as C++ can be used to write such applications, which, for
example, access low - level functions of the operating system. Background compatibility
with code of VB, ASP and COM are examples of unmanaged code.
 Unmanaged code can be unmanaged source code and unmanaged compile code.
 Unmanaged code is executed with help of wrapper classes.
 Wrapper classes are of two types: CCW (COM callable wrapper) and RCW (Runtime
Callable Wrapper).
 Wrapper is used to cover difference with the help of CCW and RCW

Native Code:-

 The code to be executed must be converted into a language that the target operating
system understands, known as native code. This conversion is called compiling code, an
act that is performed by a compiler.
 Under the .NET Framework, however, this is a two - stage process. With help of MSIL
and JIT.

MSIL:-

 It is language independent code. When you compile code that uses the .NET
Framework library, you don't immediately create operating system - specific native
code.
 Instead, you compile your code into Microsoft Intermediate Language (MSIL) code.
The MSIL code is not specific to any operating system or to any language.

Two Step Compilation Process:-

Compiled By Swarupa P.Gogate


T.Y.B.Sc(I.T.)-Advanced Web Programming 2020-2021

Compiled By Swarupa P.Gogate

You might also like