Friday, February 21, 2014

COMPONENTS OF CLR

The CLR contains the following components.
  • Security Manager / Code safety verifier
  • JIT Compiler
  • Memory Manager
  • Garbage Collector
  • Exception Manager

1.  Security Manager / Code Safety Verifier

  • This is the initial and most component of CLR.
  • Application security is much more important issues today.
  • If you analyze this in-depth, we have 3 types of security support by .NET Framework.

  A.  Evidence Based Security (EBS):

  • This security feature is meant for protecting entire assembly not to be accessed by un-authorized users.
  • the  Security  Manager  component  first  checks  privileges  of  the current  user  that  the  user  is  allowed  to  access  the  assembly  or not, based on the evidence.
  • The  evidence  is  nothing  but  the  information  about  the  security permissions  related  to  the  assembly,  that  resides  with  in  the assembly.

  B.  Code Access Security (CAS):

  • This  verifies  whether  the  current  user  is  allowed  to  perform  the actions written in the MSIL code.
  • For example, accessing the file system, event log, printing, remote or network access etc.

2.  JIT Compiler

  • As  you  seen  in  the  diagram  of  RTE  previously,  the  JIT  compiler  is  responsible  for compiling the MSIL code into the Native code.
  • The native code is directly understandable by the system hardware.
  • Memory Manager
  • The Memory Manager component of CLR, allocates  necessary  memory  for  the variables and objects that are to be used by the application.

4.  Garbage Collector

  • This component of CLR de-allocates or  cleans-up  the  un-necessary  memory  of  the application, after usage automatically.
  • Instead, in older languages such as C/C++ this kind of component is not available so that the programmer should free-up the memory explicitly using some code.

5.  Exception Manager

  • An exception means Run time error.
  • This  component  redirect  the  processor  to  execute  the  catch block or finally block, whenever an exception is occurred at run time.
  • We  can  learn  how  to  write  these  catch  and  finally  blocks  in  C#.NET  and  VB.NET languages later.