NET - Describe the managed execution process in .NET

Describe the managed execution process in .NET.

- Managed execution process is a process where CLR executes the managed code. The steps involved in this process are:

1. Compiler needs to be chosen.
2. Convert the source code to MSIL now known as CIL.
3. Convert MSIL to Native code using JIT.
4. Executing code and various services.

1. Compiler needs to be chosen:

- To obtain the benefits provided by the common language runtime, you must use one or more language compilers that target the runtime.
- It is a multi-language execution environment.
- It supports a wide variety of data types and languages, such as Visual Basic, C#, Visual C++ , Perl, COBOL compiler etc.

2. Convert the source code to MSIL:

- Now it is known as CIL.
- Compiling translates your source code into Microsoft Intermediate Language (MSIL).
- It generates the required Metadata.
- Metadata describes the types in your code, including the definition of each type, the signatures of each type members and other data that the runtime uses at execution time.
- MSIL includes instructions for loading, storing, initializing and calling methods on objects.

3. Convert MSIL to Native code using JIT:

- In this step, it is also verified if the code is type safe or not.
- This is done by examining the MSIL and Metadata.
- JIT compilation converts MSIL to native code on demand at application run time, when the contents of an assembly are loaded and executed.
- The JIT compilation takes into account the possibility that some code might never be called during execution.

4. Executing code and various services:

- The CLR(Common Language Runtime) provides the platform that enables execution to take place as well as a different type of service that can be used during execution.
- Each method for which MSIL has been generated is JIT-compiled when it is called for the first time and then run.
- The next time the method is run, the existing JIT-compiled native code is run.
- The process of JIT-compiling and then running the code is repeated until execution is complete.
- During execution, managed code receives services such as garbage collection, security, interoperability with unmanaged code, cross-language debugging support and enhanced deployment and versioning support.
NET - Explain how the .NET Framework performs automatic memory management
How the .NET Framework performs automatic memory management - Allocation of memory, Release of memory.....
NET - What is Finalizer? Explain how to implement it
What is Finalizer? - It is a method that is executed when an object is garbage collected.......
VB.NET - Difference and similarity between a class and a structure
Difference and similarity between a class and a structure - Both the class and structure are user define types. Both are the template of the object...
Post your comment