Process of managed execution

The managed execution process includes the following steps:

1.      Choosing a compiler.To obtain the benefits provided by the common language runtime, you must use one or more language compilers that target the runtime.

2.      Compiling your code to Microsoft intermediate language (MSIL). Compiler translates your source code into MSIL and generates the required metadata.

3.      Compiling MSIL to native code. At execution time, a just-in-time (JIT) compiler translates the MSIL into native code. During this compilation, code must pass a verification process that examines the MSIL and metadata to find out whether the code can be determined to be type safe.

4.      Running code. The common language runtime provides the infrastructure that enables execution to take place as well as a variety of services that can be used during execution.

Metadata

Metadata is binary information describing your program that is stored either in a common language runtime portable executable (PE) file or in memory. When you compile your code into a PE file, metadata is inserted into one portion of the file, while your code is converted to Microsoft intermediate language (MSIL) and inserted into another portion of the file. Every type and member defined and referenced in a module or assembly is described within metadata. When code is executed, the runtime loads metadata into memory and references it to discover information about your code’s classes, members, inheritance, and so on. Metadata describes every type and member defined in your code in a language-neutral manner. Metadata stores the following information:

·         Description of the assembly.

o        Identity (name, version, culture, public key).

o        The types that are exported.

o        Other assemblies that this assembly depends on.

o        Security permissions needed to run.

·         Description of types.

o        Name, visibility, base class, and interfaces implemented.

o        Members (methods, fields, properties, events, nested types).

·         Attributes.

o        Additional descriptive elements that modify types and members.

Continue ReadingProcess of managed execution