The. NET Framework for Java Programmers---2 (good)

Source: Internet
Author: User
Tags definition exception handling execution garbage collection soap naming convention try catch domain

Cls-common Language Specification

The Common Language specification (CLS) aids the development of mixed Language. It defines a subset of Common Type System which all class library providers and language designers targeting CLR must adhe Re to.
CLS is a subset of CTS. If a component written in one language (say C #) is to being used from another language (say, then the component write R must adhere to types and structures defined by CLS.

Cil-common Intermediate Language

All compilers complying with CLI must generate an intermediate language representation called Common Intermediate language (CIL). The CLI uses this intermediate language to either generate native code or use Just in Time (JIT) compilation to ex Ecute the intermediate code on the fly.
The Microsoft documents refer this standard ' s implementation as MSIL (Microsoft Intermediate Language).

Jit-just in Time Compiler

The JIT or Just in time Compiler was the part of the runtime execution environment, which was used to convert the Intermedia Te language contained in the executable file, called assemblies, into native executable code.
The security policy settings are referred in this stage to decide if code being compiled to be type safe. If not a exception is thrown and JIT-process is aborted.

Ves-virtual Execution System

Virtual Execution System (VES), is more or less equivalent to the JVM (Java Virtual Machine).
VES loads, links and runs the programs written for Common Language infrastructure contained in portable executable (PE) fi Les.
Virtual Execution System (VES) fulfills it's loader function by using information contained in the metadata and uses late binding (or linking) to integrate modules compiled separately, which could even written in different.
The VES also provides services during execution of the codes, that include automatic memory, management and profiling G Support, security sandboxes, and interoperability with unmanaged code, such as COM components.
Managed codes are intermediate Language (IL) code along with metadata contained into portable executable (PE) files, these m Ay be. EXE or. DLL. This needs just in time (JIT) compiler to convert it into native executable code. There is also a provision the pre compiled executable which is called unmanaged code. The advantage of unmanaged code is this is does not need to JIT compilation but has the disadvantage of unportablity s different operating System (OS) platforms. Microsoft ' s implementation the CLI is CLRThe Microsoft ' s implementation and adaptation of the above standard has resulted in difference in terminology, for example Common Intermediate Language (CIL) is called Microsoft Intermediate Language (MSIL) and Common Language infrastructure (C LI) is referred to as Common Language Runtime (CLR).
These are changes in naming convention, I believe, are to create a branding distinction while implementing the standards. This is probably intended to avoid the clash which occurred with the Java the language standard, Java the island, Java the Coffee brand and Java the Sun ' s trademark! But, in the long run, it would only be lengthen the already long list of confusing acronyms and jargons in the programmer ' s di Ctionary.
We use CLI and CLR interchangeably, however, it would be more correct to say this CLR is the Microsoft ' s implementation of Cli.
Apart from scripted languages like JavaScript and VBScript, the. NET Framework presently supports three compiled languages , Namely:VB.NET, VC + + and C # (pronounced C Sharp) language compilers target this runtime. The type verifiable compiler ' s output is called Managed Code.
Unsafe codes can also be generated by compilers, which is called unmanaged code.Garbage collection is only handled for managed codes.
The managed code has access to Common Language Runtime (CLR) features such as multi-language integration, exception Han Dling across language boundaries, security and versioning and a simplified deployment.
An interesting facility being experimented from Microsoft is the cross language. For example, a C # class can inherit from a VB object! Each of these features is discussed in detail later.
The CLR provides services to the managed code. The language compilers emit metadata, which describes the types, members, and references in the code. Metadata is stored along with the Code:every loadable Common language runtime image contains.
The metadata helps the CLR to locate and load classes, lay out instances into memory, resolve method invocations, generate Native code, enforce security, and set up the run time context boundaries.
The CLR, much like Java Virtual Machine (JVM) provides automatic garbage collection-Facilities code, this G Arbage Collection feature is called managed Data. But Unlike Java VM, the CLR also has mechanism to syntactically switch off automatic garbage collection called unmanaged data,Where the programmer is responsible for garbage collection.
The CLR has been designed to facilitate cross language. Two kind of integration is possible:tightly coupled and loosely coupled, which is also called Remoting. The tightly coupled inter language method call is achieved within the CLR; This is the two languages calling each of the other are both. NET Framework compliant like VC + +, or C # or are at Least COM compliant. Thus C # programs can talk to Java programs through ActiveX Java Bean bridge! This is assuming that both the C # and Java codes reside on a single computer.
Remoting or loosely coupled inter language interaction is suitable then the two interacting programs written in different Languages are on different operating system (OS) platforms, like C # client residing on Windows CE talking to Solaris based Server Side Java code. This integration is achieved through a XML based protocol called Simple Object Access Protocol (SOAP) which was proposed  By Microsoft and are adopted by the Consortium of the Consortium ( An open source SOAP gateway implementation The Java is available from in
SOAP has transport layer independent, XML formatted content and currently HTTP and SMTP transport, implementations are Lable from both Microsoft and for. NET Framework and Java platforms respectively.
All. NET Framework components carry information about the components and resources they use, in a XML formatted document C Alled metadata. The runtime, uses this information to dynamically link the components, ensuring version integrity and security controls; This is makes the application theoretically more resilient against version changes. Only time would tell if this innovation is successfully implemented.
Another good feature introduced in the new framework is reduction of Windows system registry dependency. Registration information and state data are no longer stored in the system registry, but inside the metadata. This should make the server side component deployment much easier.
The. NET framework ' s Common Language Runtime (CLR) claims to have the ability to compile once and run on any CPU and operating System that supports the runtime. We'll be here becomes a real possibility in near future.

Common Intermediate Language (CIL)

The. NET framework ' s implementation of Common intermediate Language (CIL) is called Microsoft Intermediate Language (MSIL ). Unless specified otherwise, we'll use the terms intermediate Language (IL), MSIL and CIL interchangeably.
Managed code is produced by one of the three compilers which translate the source code into Microsoft intermediate LANGUAG E (MSIL).

Common Intermediate Language (CIL) and therefore it ' s Microsoft rendering called Microsoft Intermediate Language (MSIL) is Said to is a CPU independent set of instructions that can is efficiently converted to native code.
MSIL Intermediate Instruction set has instructions for loading, storing, initializing, object method calling, many conv Entional instructions for arithmetic and logical operations, control flow, direct memory access, and exception handling. All of the three languages included in this framework have Java like \ Try catch\ exception handling.
Just like Java, before the managed code is executed, the intermediate language are converted to CPUs specific code by a jus T in time (JIT) compiler. The runtime supplies one or more JIT compilers to each computer architecture it supports. However, the code can is compiled into native form during installation itself.
When a Common Language specification (CLS) compliant compiler produces Common intermediate (CIL), it Language also s metadata, describing the Common Language Types (CLT) specific Types used in the code, including the definition of Type, the signatures of each type ' s, the members, the code references, and the runtime uses at Execution time.
The MSIL and metadata are contained in a portable executable (PE) file which are an extension of the Microsoft portable Exe Cutable (PE) and Unix World "s Common Object File Format (COFF) used for executable content. They appear to the user as the familiar. EXE and. DLL files.
One of the fundamental differences between Java Virtual Machine (JVM) instruction sets and Common intermediate Language (C IL) is this JVM is big endian (most significant byte a) and CIL uses little endian (least significant byte-a) Bi Nary representation. This difference'll is apparent to most of the programmers. Only system level programmers would have to deal with it.
The file format, can accommodate either of Common intermediate Language or native code as a metadata, a signature PA The operating system to recognize Common Language Runtime Ttern enables.
The presence of metadata in the executable file enables the components to be self descriptive. This is eliminates the need for additional type libraries or Interface Definition Language (IDL) used in DCOM and CORBA. The runtime locates and extracts the metadata from the file as necessary during.

Managed Execution

There are two kinds of codes that can exist inside the executable files now, the old machine dependent codes, like Existin G ActiveX controls, are called unmanaged
As mentioned earlier, there are currently three compiled languages C #, C + + and VB provided by Microsoft, which target the Common Language Runtime (CLR). This runtime is a multi-language execution environment, and supports a common base of data types and language features. However, the language compiler determines what subset of the runtime ' s functionality is available, and the Of the code is influenced by the features exposed by the compiler.
The coding syntax is determined by the compiler and not by the runtime. If the component is required to being completely usable by components written in other languages, it must with only language F Eatures that are included in the Common Language specification (CLS) in the component ' s exported types.

Application Domains

Application domains are light weight process. It can be visualized as a extension of Java ' s sandbox security and Thread model.
The Common Language Runtime provides a secure, lightweight unit of processing called a application domain. Application domains also enforce security policy.
By light weight It means this multiple application domains run in a single Win32 process, yet they a provide of kind T isolation, which is fault in one application domain does not corrupt other application. This is aids in enhancing execution security against viruses as as a helps in debugging faulty.
The Common Language Runtime relies on type safety and verifiability features of Common type System (CTS) to provide fault Isolation between application domains. Since type verification can be conducted statically before execution, it's cost efficient and needs less security support from microprocessor hardware.
Each application can have multiple application domains with it. And each application domain has a configuration file, containing the security permissions. This configuration information are used by the Common Language Runtime to provide sandbox security similar to that of Java Sandbox model.
Although multiple application domains can run within a process, no direct calls are allowed between methods of objects in Different application domains. Instead, a proxy mechanism is used to code space isolation.

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: 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.