Sunday 28 December 2014

.Net Framework: All about CLR- Part I - Chapter 1, Section 1. Post #1


Dear Readers,

Whatever technologies you learn in .Net, You must learn the concept of CLR first. CLR is the very basic part of .Net framework. Lets this discuss with Yendhr9014, an answering computer. Over to Yendhr9014..

Me: What is CLR?
Visual overview of the Common CLR Language Inf...
Visual overview of the Common CLR Language Infrastructure, and how the components relate to each other. (Photo credit: Wikipedia)
Yendhr9014: Common Language Runtime, A runtime environment which doesnt know which language code they have taken to execute.

Me: A Runtime?

Yendhr9014: A time in which a program is executing is called a Runtime. It is one of a phase in program lifecycle.

Me: A Program Lifecycle?
Yendhr9014: Yes its consist of Edit time (a programmers developing time), Compile time(Taken by compilers to change the code to the machine language), Distribution time, Installation time, Link time, Load time, and Run time.

Me: Its deviating from CLR, I think, Lets focus on only CLR. Got it? What is the role of CLR in .Net Framework?
Yendhr9014: It is the heart of .Net Framework which take care of memory management, Assembly loading, security, exception handling and thread synchronisation.

Me: How it will take care of these?
Yendhr9014: You asked it very simple, do you want me to explain in detail?

Me: Yes, of course, you can start explaining but keep in mind that your answer shouldnt confuse me.
Yendhr9014: Understood. CLR is...

Me:  Sorry to interrupt, just start it with simple, what happens when i press run in my Hello world program?
English: Since the toolserver is virtually dow...
English: Since the toolserver is virtually down, I'm downloading it and configuring it the hard way. This file is a derivative of Leif Arne Storset's Image:Common Language Runtime diagram.svg, and I'm carefully reusing his license and crediting him as the Holy Open Forces demand from us. Amen. (Photo credit: Wikipedia)
Yendhr9014: I assume that your Hello world program developed in a C# language, it first needs compilation before executing, C# Compilers which is in the CLR itself, complies your source code first before execution as according to Just in Time Compilation. The output will be the managed modules. Source code is then converted to Managed Modules.

Me: According to Just-In-Time Compilation? What is it mean? Is it like just compile this only before execution?
Yendhr9014: Yes boss, you nailed it right. Assuming the word nailed is a formal communication between us.

Me: Hahaha cool dude, Wait? The output of my source code is converted to some other thing called Managed Modules before execution? What is meant by Managed Module, explain this first.
Yendhr9014: Glad to help, Managed Module is a standard Portable Execution file (PE file, PE32 for 32 bit windows and PE32+ for 64 bit windows). CLR is looking for this file in order to execute.

Me: A "PE"? What it is?
Yendhr9014: Pronounciation error, Please pronounce those letters separately "P-E". A Managed module will have PE32(+) Header, CLR Header, Intermediate Language and Metadata. May I fetch more PE related data from this link? http://msdn.microsoft.com/en-us/library/ms809762.aspx

Me: No Time, Lets go through heading One by One, What is PE32(+) Header?
Yendhr9014: (to be continued in next post)

**********************
Questions for the next conversation
Me: What is managed code and unmanaged code?
Me: So all compilers will produce IL code from the source code?
Me: Come some points about d) Metadata. Every book tells that it is a data about data. I need something more than that?
Me: Can you say some more uses of having metadata?

Click here for continuation on Post #2 on CLR
28 Dec 2014


No comments:

Related Posts