What is CLR (Common Language Runtime)?


CLR is a part of .NET Framework which manages the execution of several supported .NET languages, allowing them to share Common Object-Oriented Classes. CLR is somewhat comparable to Java Virtual Machine. Microsoft refers to its Common Language Runtime as “Managed Execution Environment“. 

CLR held responsible for these important activities:

  1. Garbage Collection: CLR automatically manages memory, thus eliminating memory leaks. When objects are not referred, GC (Garbage Collector) automatically releases those memory thus providing efficient memory management.
  2. CAS (Code Access Security): CAS grants rights to program depending on the security configuration of the machine. For instance, if the program has rights to edit or create a new file but not  to delete a file. CAS ensures that the code runs under the environment of machines security configuration.
  3. CV (Code Verification): This ensures proper code execution and type safety while the code runs. It prevents the source code to perform illegal operation such as accessing invalid memory locations etc.
  4. IL to Native code Translation/Optimization: CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.

(4)

What is Cell Broadcast Message?

Cell Broadcast is a term used in Telecom that means to send a particular information to all the users within a certain area at once, and this information is called Cell Broadcast Message. This can be used, for example, for providing the traffic reports, weather reports etc. 
To create a Cell Broadcast Message, the sender has to  give the provider the information ha/she wants to send, usualy using a web-based interface (Web Page) offered by the provider. The sender visits the provider’s web page, logs into his/her account and creates a new message, and specifies when and to whom the message will be delivered. The Service Provider stores this information until it’s time to send the message. As soon the time ticks, computers take care of broadcasting the message.

(2)

What is Native Image Generator (Ngen.exe) and how does it work?


Ngen.exe (Native Image Generator) is a tool that creates native images, which are files containing compiled Processor-Specific machine code, and installs them into the native image cache on the local computer. It’s a tool that improves the performance of managed applications. In other words, rather than compiling the code dynamically using JIT on runtime, a full image of native compiled code is stored in cache while installing the application which leads to better performance as the assembly loads and execute faster.

The runtime can use native images from the cache instead of using JIT to compile the original assembly.
It not always necessary that Ngen.exe produces optimized code because it uses the current environments parameters which can change over a period of time. For instance, a code compiled in Windows XP environment will not be optimized to run under Windows 2008 server.
The following command is used in Visual Studio command line to install a full compiled native code in cache:
<input disabled="" style="font-size: 20px; width: 100%;" type="text" value=" ngen.exe install ” />

(8)

What are different types of JIT?

There are 3 types of JIT compiler in .NET:

  1. Normal JIT: It’s the Default or Standard JIT compiler which compiles only those methods that are called at runtime. These methods are compiled the first time they are called, and are stored thereafter in cache. This compiled code is served from cache on all further calls to these methods. It produces optimized code.
  2. Econo JIT: It also compiles only those methods that are called at runtime. It has a  has a faster compilation speed and a lesser compiler overhead than Standard-JIT and requires less memory. These compiled methods are not stored in cache so that RAM memory remains available in optimal manner. Econo-JIT just produce the native counterpart of MSIL instructions However, the Standard-JIT generates more optimized code than the Econo-JIT and includes the verification of MSIL code.
  3. Pre-JIT: It compiles the complete source code into native code in a single compilation cycle. This is done at the time of deployment of application. We can implement Pre-JIT by using ngen.exe.
Basically Econo-JIT is chosen when devices have limited memory and CPU capacity like windows CE powered device. If the machine has no memory limitation with better CPU power, Normal-JIT is used. 

(7)

What is IL Code?

IL (Intermediate Language) Code is CPU independent partially/half compiled code. Partially means this code is not compiled to machine/CPU specific instructions. The reason behind it’s not fully compiled is: we do not know in what kind of environment .NET code will run i.e. what can be the end operating system, CPU configuration, machine configuration, security configuration etc. So the IL code is half compiled and on run time this code is compiled to machine specific instructions using the environment properties by JIT (Just-In-Time) compiler.

(42)