C # Learning Series-. NET Architecture

Source: Internet
Author: User

Original address: http://www.cnblogs.com/woxpp/p/3904854.html

. NET Framework Overview

The. NET framework is. NET applications run to provide a virtual machine environment that provides compile, run, memory management, garbage collection, security, and other services for. NET applications.

. NET Framework Components

1. Common language Runtime (Common Language RUNTIME,CLR)

The 2.NET Framework class library (not all class library code in the. NET Framework is written in purely managed code, and a considerable number of classes in the. NET Framework are encapsulated in the Win32 API)

Managed code

Use. NET common language runtime, and vice versa for unmanaged code (such as the Win32 API)

Common Language Organization framework (CLI Common Language Infrastructure)

Specifies how types are declared, used, and managed in the runtime, as well as an important part of the runtime's support for cross-language interoperability

1. Build a framework that supports cross-language integration, type safety, and high-performance code execution

2. Provide an object-oriented model that supports the complete implementation of multiple programming languages

3. Define the rules that each language must follow to help ensure that objects written in different languages interact

Common language Runtime (CLR)

Responsible for management. NET application compilation, run, code type security checks, memory allocation, thread management, security, garbage collection, and other services to provide a virtual runtime environment for. NET Applications

Common type systems (CTS Common type System)

The CTS defines a type library, either VB or C #, whose data types are consistent, so. NET abstracts the data types of various programming languages, the CTS is born.

CTS types are mainly divided into: value types and reference types Http://wenku.baidu.com/link?url=LHBzlpJ8zHnLvsNzcmGxjpGgOolfq721gDvoVTY7gtNHTUbmhf_ Zv8z0glizecruyg020kqzhzetwvawstyqjzgxafodsmvva411vnacau7

Common Language Specification (CLS Common Language specification)

The CLS is a subset of the CTS, and the goal is to let. NET platform can be called between objects written in different programming languages

CLR, The CTS, CLS three relationships are as follows:

value type: stored in the memory stack, fast access, out of scope automatically frees memory, garbage collection mechanism does not participate in recycling.

Reference type: allocated in memory, the default NULL, the address of the memory allocated in the stack, the operation through the pointer to seek through the garbage collection mechanism to reclaim. When you assign the contents of a reference type variable to a variable of another reference type, only the memory address of the variable is copied.

Boxing : Converting a value type to a reference type int i=0; Object o=i;

unpacking : Converting a reference type to a value type int i=0;object o=i;int j= (int) o;

Packing and unpacking have an impact on performance loss.

Instant compile (JIT)

    1. At compile time: the CLR compiles C # code once, generating intermediate code (MSIL is now called CIL Common Intermediate Language)dll or EXE.
    2. At run time, the CLR compiles the intermediate code into binary code and executes according to the hardware environment using JIT (immediate compilation engine).
    3. The compiled binary code is stored in a buffer cache, and the next call to the same code is made directly from the cache, meaning the same code is compiled only once.

NGEN (native Image Generator) compilation

The native Image Generator (Ngen.exe) is a tool for improving the performance of managed applications. Ngen.exe Create native images (files that contain compiled processor-specific machine code) and install them into the native image cache on the local computer. Instead of compiling the original assembly with the real-time compiler, the runtime can use the native image from the cache.

C # Learning Series-. NET architecture

Related Article

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.