What is "Runtime Environment" really?

Asked

Viewed 1,277 times

19

Studying a little about ASP.NET 5 I came across something I did not understand very well. To use it you need to install KVM (K Version Manager) and KPM (K Package Manager). KVM is responsible for managing versions of KRE (K Runtime Environment). In Powerhsell when using

kvm list

I have an answer more or less like this

Active Version     Runtime Architecture Location                    Alias
------ -------     ------- ------------ --------                    -----
       1.0.0-beta1 CLR     amd64        C:\Users\User\.kre\packages
       1.0.0-beta1 CLR     x86          C:\Users\User\.kre\packages default
       1.0.0-beta1 CoreCLR amd64        C:\Users\User\.kre\packages
       1.0.0-beta1 CoreCLR x86          C:\Users\User\.kre\packages

From what I understood then this KVM manages different versions of CLR. But the fact is that until today I do not understand very well what is Runtime. My understanding of CLR today is quite on top, I understand this: when developing an application using C# the compiler transforms the code into an intermediate language called CIL (Common Intermediate Language) and then CLR is responsible for interpreting this intermediate code.

Thus, although the C# code is compiled, the CLR still has to interpret an intermediate code. My understanding is that the "Runtime Environment" is the environment in which CLR interprets this intermediate code.

I don’t know if that’s it. So, what is this "Runtime Environment" really about? And why are there so many different versions now?

1 answer

15


The CLR is the Runtime Environment. O R is just Runtime. It is the infrastructure responsible for implementing the programme.

In a way we can say that every program needs a system of Runtime. Some need very little - case of very simple things written in Assembly (your best chance at Runtime be very mild or nonexistent) and C, others need a lot - cases of interpreted languages.

The fact that you need to ask for things for the operating system (a memory allocation for example) already requires a Runtime. It is nothing but a set of codes that allow the program to do basic things.

In the case of . NET the Runtime is nothing trivial. He is responsible for:

  • accommodate the entire code;
  • compile Just in Time (which is a little different from just interpreting the bytecode of CIL);
  • take care of security;
  • manage the memory (GC);
  • deal with the exceptions;
  • provide reflection;
  • provide and control interoperability between their languages and with native external code, including operating system services (memory, processes, resource access, etc.);
  • has a part of the standard library that is required for the basic functioning of any application;
  • and still have subsystems that allow monitoring and diagnosis of the application (probably forgot something).

So you already knew a part of what CLR is.

Note that CLR exists for a specific platform. It’s the .NET. platform, so we don’t need to (or we didn’t need to) worry about which platform to run on. He cares for us but at the lowest level there has to be something specific.

There are different versions because there are different evolutions and needs. Before the motto was to have one thing only that served everything, now it seems that it is better to have specialized versions that best suits only what you need. Every approach has its advantages.

The . NET already had some versions of CLR but you didn’t need to worry about it. It was selected the one that best served. For better resource optimization you need to worry if you want to. This has been solved because with CLR unification there will be only one . NET.

Some information about variations can be obtained in this blog.

Official Coreclr open source code for you to try to understand everything inside :) Have fun.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.