zoukankan      html  css  js  c++  java
  • ASP.NET基础再出发系列 之一

    什么是.net framework?

    ==========================

    你可以把.net framework看作是编写和运行软件的一个可安装的基础设施. 你在Windows操作系统上安装了这个基础设施之后, 它就会创建一个庞大的代码类的库用以帮助你书写代码, 它还会创建一个与这些代码相匹配的运行平台, 也叫做进程虚拟机或应用程序虚拟机.

    .net framework可以工作在很多不同的代码语言上, 确切的说是任何一种支持.NET的语言, 比如说C#, ASP.NET, VB.NET. 这个基础设施包含各种各样的类, 涵盖诸如User Interface rendering, 文件读写, 数据库连接, 网络通信, 加密等等方面. 所有的这些都在base class library中, 程序员在写代码的时候会将这些基础类应用到自己的代码中去.

    .net framework的精准定义如下:

    A process virtual machine runs inside the OS as a normal application. It serves a single application process and is spun up when the application begins, and destroyed when the application stops. This little, isolated environment helps the code inside to be indifferent to hardware and OS details.

    它是一个在操作系统上运行的普通应用程序进程. 它提供了一个单独的应用程序进程, 并且在应用程序开始的时候被创建, 并在应用程序结束的时候被销毁. 这个小的, 隔离的环境会帮助其中的代码忽略操作系统和硬件的细节.

    什么是CLR?

    ==========================

    CLR全称是Common Language Runtime, 它是.net initiative的核心部分, 更重要的, 它或许是CLI(common language infrastructure)标准的核心部分. 它是由.net提供的用于运行软件的虚拟机.

    The purpose of the Common Language Infrastructure, or CLI, is to provide a language-neutral platform for application development and execution, including functions for exception handling, garbage collection, security, and interoperability.

    Common Language Infrastructure(CLI)的目的是为应用程序开发和执行提供一个中性语言的平台, 其中包括用于实现异常处理, 垃圾收集, 安全控制和互操作性的函数.

    CLR是.net framework的虚拟机组件. 所有的.net程序在CLR的监督之下执行, 从而保证在内存管理, 安全, 异常处理方面的某些属性和行为得到设置和执行.

    CLI标准定义了一个环境, 这个环境允许在不同的计算机平台上, 多种高级语言可以在其中使用而不需要针对某种架构重新编写. 它有点像为DLL服务的硬件抽象层(HAL), 这样开发者就不需要担心运行程序或DLL的操作系统或者CPU的种类.

    During compilation of .NET programming languages, the source code is translated into Common Intermediate Language code rather than platform or processor-specific object code. CIL is a CPU- and platform-independent instruction set that can be executed in any environment supporting the Common Language Infrastructure (either the .NET runtime on Microsoft Windows operating system, or the independently derived Mono, which also works on Linux or Unix-based operating systems). CIL code is verified for safety during runtime, providing better security and reliability than natively compiled binaries.

    在.net编程语言的编译过程中, 源代码汇编翻译为Common Intermediate Language(通用中间语言)代码, 而不是被翻译为面向具体平台或处理器的目标代码. CIL是一种独立于CPU和平台的指令集, 该指令集可以在任何支持Common Language Infrastructure的平台上执行(可以是windows操作系统上的.net runtime, 或者是独立派生的叫做Mono的平台, Mono可以在Linux或基于Unix的操作系统上工作). CIL代码会在运行时候验证安全性, 从而比natively编译的二进制文件有更好的安全性和健壮性.

    你作为一个开发人员, 在.NET 高级语言上进行编写代码的工作, 比如说C#.

    编译器读取你的代码后创建中间语言(CIL)代码, 这种代码是比较低等级的, 但是仍然是可以读懂的代码.

    在运行时, just-in-time编译器会把CIL代码翻译为’native code’, 所谓native是指对某个指定的OS是native的.

    image

    CLR负责一下的方面:

    • 内存管理
    • 线程管理
    • 异常处理
    • 垃圾收集
    • 代码安全

    那么什么是Just-in-time编译呢?

    ==================================

    Just-in-time compilation (dynamic translation) is a way of improving code/program performance. Instead of compiling ahead-of-time (which is the other, static type of code compilation), JIT is always compiling just as code is needed, and if a piece is already compiled, this piece will be cached for later use.

    Just-in-time编译, 也叫dynamic translation(动态翻译), 是一种提供代码或程序性能的途径. JIT从来只是在代码需要被执行的时候进行编译, 而不是在执行前全部编译(也就是另一种静态的代码编译方式), 并且如果一段代码已经编译过了, 那么这个编译过的段会被缓存起来供稍后使用.

  • 相关阅读:
    获取全部校园新闻
    爬取校园新闻首页的新闻
    网络爬虫基础练习
    团队总结
    团队第二阶段冲刺绩效评估
    第二阶段冲刺第七天站立会议
    第二阶段冲刺第六天站立会议
    第二阶段冲刺第五天站立会议
    内测版本
    第二阶段冲刺第四天站立会议
  • 原文地址:https://www.cnblogs.com/awpatp/p/2139315.html
Copyright © 2011-2022 走看看