CLR (Common Language Runtime)

Source: Internet
Author: User
CLR (Common Language Runtime) is the basis for building the entire. net framework. It is the key to implementing core features such as. Net cross-platform, cross-Language, and code security. The CLR is also a runtime environment like the Java Virtual Machine. It is responsible for resource management (memory allocation and garbage collection) and ensures necessary separation between applications and underlying operating systems.

To improve the reliability of the platform and the stability level required by transaction-oriented e-commerce applications, CLR is also responsible for other tasks, such as monitoring program running. Follow. NET statement, the program running under CLR monitoring belongs to the "managed" code, applications or components that are not running under CLR and directly on bare metal are unmanaged code.
CLR will monitor various common programming errors. These errors have been the main source of software faults for many years, including access to array elements out of bounds and access to unallocated memory space, memory overflow caused by a large data volume.

However, this kind of running monitoring of managed code has a price. Although it is not possible to accurately obtain the overhead required for the monitoring program, from the performance of the current Beta test, as Microsoft acknowledges, we can expect that the performance reduction caused by it should be at least 10%. Of course, if the monitoring program can improve the stability and availability to a new level, we can doubt whether the performance reduction of 10% is also a bad thing ......

Moore's law has been proven to be correct in terms of processor performance improvement. In this case, how long does it take to get a server with a performance increase of 10%?Instructor's explanation:The public Language Runtime Library is the basis of the. net framework. It runs code and provides services that make the development process easier.Managed code: the code that targets the public Language Runtime is called managed code. (Based on. net)Clr functions:1. Manage memory 2. Thread execution ......Managed execution process: select the compiler. Compile the code into an intermediate language (msil ). Compile msil into local code. Run the code.Microsoft intermediate language (msil)A group of commands that can effectively convert to Local Code and are independent of the cpu.When compiled as managed code, the compiler translates the source code into microsoft intermediate language (msil ).At runtime, the real-time (jit) compiler now converts msil to specific and cpu code.Metadata (which classes are included in the description program and the entry points ?)Metadata is a binary information used to describe a portable executable file (pe) file stored in a Common Language Runtime library or a program stored in memory.All types and members of the Products set and consumed in the module will be described in the metadata.When executing the code, the runtime loads the metadata into the memory and references it to find information about the Code, such as classes, members, and inheritance.Hosting moduleStandard windows Executable File (pe) that requires clr to run.Including PE Header, metadata, and intermediate languageAutomatic Memory Management (learn more)Steps for accessing resources:1. Allocate a certain amount of memory space for the type of a specific resource.2. Initialize the allocated memory space.3. Use resources.4. Destroy the resource status.5 .......Garbage collection mechanism (GC)Simplifies memory management and automatic collection.Function: allocate memory, release memory, level, and performance, and release memory for unmanaged resources (not included in CLR) (explicitly cleared)Assembly importanceThe Assembly is the construction block of the. NET. Framework Application (exe, dll ......)An assembly is a collection of types and resources generated for collaborative work.The Assembly can be static or dynamic.Static storage in portable executable files on disksDynamic Assembly runs directly from memory and is not stored on disk before execution.Assembly function:Contains codeForming security boundariesForm Type BoundaryForming reference range BoundaryForm the assembly version boundary (exclusive to. net)Form Deployment UnitIs a unit supporting parallel execution.Static assemblyAssembly List, including Assembly metadataType metadata...Single assemblyMulti-file assemblyTwo types of AssemblyWeak naming assembly, no signature, anyone can useStrongly-named assembly with a public/private key pair SignatureApplication domain (rarely used)Purpose: Isolate code or use and uninstall the dll.

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.