1: First define the concept of the CLR:
CLR (Common Language Runtime): The common language runtime is a "runtime" that can be used by multiple programming languages;
At run time, the CLR doesn't care what language the developer uses to write code, it only focuses on whether the language is oriented toward the CLR (runtime-oriented).
The core features of 2:CLR include:
Memory management, assembly loading, security, exception handling, and thread synchronization.
3::
650) this.width=650; "src=" Http://image.mamicode.com/info/201507/20181020180355327012.png "style=" margin:0px; padding:0px;border:0px; "/>
Regardless of which compiler is used, the result is a managed module (managed module), when managed code is a standard 32-bit/64-bit Microsoft Windows Portable Execution Body (pe32/pe32+) file.
The local code compiler, which generates code for a specific CPU architecture (x86,x64 or IA64). Instead, each CLR-oriented compiler generates IL (intermediate language) code, which is also known as managed code.
In addition to generating IL, each compiler that targets the CLR also generates complete metadata in each managed module, which is a set of data tables. Some data tables describe what is defined in the module, which is actually some of the complete data generated by the compiler.
4:CLR actually does not work with the module, it is working with the assembly.
5: Loading the Common language runtime
Each assembly that we build can be either an executable application or a DLL, and ultimately, the CLR manages the execution of the code in those assemblies, so you must install. NET Framework.windows Some versions of the system are built-in and packaged in a running machine. Net The FrameWork. But we need to open it manually. Can be started in the control panel this is not explained in detail. As a developer, this is not a requirement.
6: Code to execute Assembly
To execute a method, the first must convert its IL to the local CPU instruction, which is the nature of the CLR's JIT.
:
650) this.width=650; "src=" Http://image.mamicode.com/info/201507/20181020180355658079.png "style=" margin:0px; padding:0px;border:0px; "/>
Just before the main method executes, the CLR detects all of the types referenced by the code in Main, which causes the CLR to assign an internal data structure that manages access to the referenced type.
A method can cause some performance damage only on the first call, and all subsequent calls to the method run at full speed in the form of native code. No need to re-validate IL and compile the cost code.
The JIT compiler stores the local CPU instructions in dynamic memory, and once the application terminates, the compiled code is discarded, so if you run the application again in the future, or if you start two instances of the application at the same time, the JIT compiler must compile the IL again with the cost of the instruction.
6:il validation.
Il is stack-based, so all of its instructions have to press the operand into (push) an execution stack and eject (POP) The result from the stack. Since IL does not provide instructions for manipulating registers, people can easily create new languages and compilers, Generates code for the CLR. Il directives are untyped. The advantage of IL is that it is robust and secure, because it compiles to CPU instructions and the CPU verifies whether it is secure.
7:framework Class Library
FCL (Framework Class Library): is a group of DLL assemblies that contain a number of type definitions, each of which exposes some functionality.
Web services: Web Service technology or WCF technology that can easily handle messages sent over the Internet.
Web Forms application: Web Form
Windows applications: Developing Windows GUI applications.
Rich Internet applications: Silverlight technology that allows you to build GUI applications that are deployed over the Internet. This program can be run either inside or outside the Web browser, or on a non-Windows operating system with a mobile device fool.
Window Console: Provides a simple and quick and easy way to build applications, compilers.
Window Service: You can build a service application through the. NET FrameWork.
Database stored procedures: writing stored procedures
Component libraries:. NET Frameword allows you to build standalone assemblies (components) that contain types that can be easily integrated into any library.
This article is from the "Albin" blog, make sure to keep this source http://albin.blog.51cto.com/9047703/1669846
Introduction to the CLR execution model