Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Productivity Improvements in Mono 2.4: Components and Architecture : Page 3

Take a look under the hood of the latest version of Mono, the open source .NET development framework. Find out how its components and architecture help make developers more productive.


Mono 2.4 Architecture

This section describes the pieces of the Mono 2.4 architecture (as shown in Figure 1).

Just-in-Time Engine

The Mono runtime contains a JIT engine for a number of processors: MIPS (in 32-bit mode only), x86, SPARC, PowerPC, ARM, S390 (in 32-bit and 64-bit modes), and x86-64 and IA64 for 64-bit modes. The runtime will perform a just-in-time compilation to the machine's native code, which is cached as the application runs. It is also possible to precache the native image before execution.

However, Mono's current conservative garbage collector (the "Boehm-Demers-Wiser Conservative Garbage Collector") presents a serious drawback compared to commercial garbage-collected runtimes such as the Java Virtual Machine or the .NET framework's runtime. Theoretically, you could run into memory leaks that may even result in an abrupt end to an application's execution due to an out-of-memory condition. This is especially a grave concern for server applications meant to run for a long time. The Mono team is currently developing a modern, "real" garbage collector, but a date for incorporation into a production release has not been set.

Class Library

The class library provides a comprehensive set of facilities for application development. They are primarily written in C#, but due to the Common Language Specification they can be used by any .NET language. The class library is structured into namespaces and deployed in shared libraries known as assemblies. References to the .NET framework are primarily references to this class library.

Namespaces and Assemblies

Namespaces are a mechanism for logically grouping similar classes into a hierarchical structure. This prevents naming conflicts. The structure is implemented using dot-separated words, where the most common top-level namespace is System, such as System.IO and System.Net. There are other top-level namespaces as well, such as Accessibility and Windows. A user can define a namespace by placing elements inside a namespace block.

Assemblies are the physical packaging of the class libraries. These are .dll files, just as (but not to be confused with) Win32 shared libraries. Examples of assemblies are mscorlib.dll, System.dll, System.Data.dll, and Accessibility.dll. Namespaces are often distributed among several assemblies, and one assembly can be composed of several files.

Common Language Infrastructure and Common Language Specification

The Common Language Infrastructure (CLI)—more commonly known as the Common Language Runtime (CLR)—is implemented by the Mono executable. The runtime is used to execute compiled .NET applications. The common language infrastructure is defined by the ECMA standard. To run an application, you must invoke the runtime with the relevant parameters.

The Common Language Specification (CLS), specified in chapter 6 of ECMA-335, defines the interface to the CLI, such as conventions like the underlying types for Enum. The Mono compiler generates an image called the Common Intermediate Language that conforms to the CLS. The Mono runtime takes this image and runs it. The ECMA standard formally defines a library that conforms to the CLS as a framework.

Managed and Unmanaged Code

Within a native .NET/Mono application, all code is managed; that is, it is governed by the CLI's style of memory management and thread safety. Other .NET or Mono applications can use legacy code, which is referred to as unmanaged, by using the System.Runtime.InteropServices libraries to create C# bindings. Many libraries that ship with Mono, such as Gtk#, use this feature of the CLI.

The Mono Option

Mono is an open source product that is still in a constant improvement phase. Hopefully, the open source and .NET development communities will benefit from the Mono platform. For users who want to run projects at a low cost based on a rapid web application development framework, Mono is one of the best options available.

Comment and Contribute








