A little thought about. NET Framework, CTS, CLI, CLS, CLI

Source: Internet
Author: User

/*

Author: Jiangong SUN

*/

 


Terms:


CTS: Common Type Specification

CLI: Common Language Infrastructure

CLS: Common Language Specification

CLR: Common Language Runtime

JIT: Just In Time
Pencil: Common Intermediate Language

MSIL: MicroSoft Intermediate Language

VES: Virtual Execution System

NGEN: Native image GENerator

FCL: Framework Class Library

 


Relationships:

CLR <=> VES

Managed code <==> MSIL <==> pencil

Unmanaged code <==> native code <==> machine code

 


CLR, CTS, CLS and metadata specification are all parts of CLI.

CTS: Microsoft introduces CTS to intercommunicate among data types in different programming ages.

CLS: It defines rules that all. NET versions ages shocould respect, and it's part of CTS.

CLR is the Microsoft implementation of VES.

CLR contains: Garbage collector for automatic memory management, JIT for compilation from cel to native code, Type checker, Debug engine, Security engine, Class loader, Thread support, Exception manager, Com marshaler.

 


Computers can only understand machine code.

Machine code is a sequence of binary (1 and 0 ).

 


C # is a compiled language, because it's compiled to pencil, and then it's interpreted by JIT to machine code.

 


The difference between compiled language and interpreted language is: Interpreted language will be executed by interpretor, line by line on local machine.

 


Compiled language:


More rapid execution speed, because it's already compiledand targeted to local machine

Less memory usage, because it's compiled

 


Interpreted language:

Independent platform, because it doesn't need to be compiled

Code size is smaller than compiled code

 

. NET Framework: consists of Common Language Runtime and Class Library.

 


C # source code execution steps:

C # source code -- C # Compiler(csc.exe) --> pencil/MSIL (managed code/byte code) stores in assemblies like DLL or EXE -- JIT in CLR or NGEN --> native code (unmanaged/machine code) --> Execution

 

 

Difference between managed code and native code/machine code/unmanaged code:

Code compiled by C # sharp compiler is called managed code, it's stored in assemblies like DLL or EXE files.

Managed code is the intermediate code between source code and native code.

Managed code is CPU independent code.

 


MSIL must be converted to CPU-specific code which is machine code to be run, it will be compiled by JIT compiler in CLR at runtime.

CLR supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and run on any supported architecture.

Native code runs straight on the CPU. They are machine code targeted towards a specific architecture (for instance, Intel's x86). It 'scpu-Specific code.

Native code is the code whose memory is not "managed". There is no reference counting, no garbage collection.


Difference between JIT and NGEN:

The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications.

Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installthem into the native image cache on the local computer. the runtime can use native images from the cache instead of using the just-in-time (JIT) compiler to compile the original assembly.


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.