In addition to the CTS and CLS specifications, the final three-letter abbreviation (TLA) to contend with at
the moment is the CLR. Programmatically speaking, the term runtime can be understood as a collection
of services that are required to execute a given compiled unit of code. For example, when Java developers
deploy software to a new computer, they need to ensure the Java virtual machine (JVM) has been installed
on the machine in order to run their software.
The .NET platform offers yet another runtime system. The key difference between the .NET runtime and
the various other runtimes I just mentioned is that the .NET runtime provides a single, well-defined runtime
layer that is shared by all languages and platforms that are .NET-aware.
The crux of the CLR is physically represented by a library named mscoree.dll (aka the Common Object
Runtime Execution Engine). When an assembly is referenced for use, mscoree.dll is loaded automatically,
which in turn loads the required assembly into memory. The runtime engine is responsible for a number of
tasks. First, it is the agent in charge of resolving the location of an assembly and finding the requested type within the binary by reading the contained metadata. The CLR then lays out the type in memory,
compiles the associated CIL into platform-specific instructions, performs any necessary security checks,
and then executes the code in question.
In addition to loading your custom assemblies and creating your custom types, the CLR will also
interact with the types contained within the .NET base class libraries when required. Although the entire
base class library has been broken into a number of discrete assemblies, the key assembly is mscorlib.dll,
which contains a large number of core types that encapsulate a wide variety of common programming tasks,
as well as the core data types used by all .NET languages. When you build .NET solutions, you automatically
have access to this particular assembly.
Below Figure illustrates the high-level workflow that takes place between your source code (which is
making use of base class library types), a given .NET compiler, and the .NET execution engine.
Comments
Post a Comment