1
$\begingroup$

I was wondering about the nature of these managed languages i-e since c# and java both are converted into intermediate language and byte code respectively, and are interpreted by their respective runtime(s). So if they are somehow pure interpreted languages then is it feasible to develop any crucial application on these technologies?

$\endgroup$
3

1 Answer 1

3
$\begingroup$

It depends on what you mean by "crucial", "feasible", and "interpreted." Certainly applications which many people consider to be crucial are written in C# and Java, so in some sense the answer to your question must be "Yes." But we can try to dig a little deeper.

While it is true that Java and C# are both compiled into byte code, in general the byte code is not directly run by an interpreter. Instead it is Just In Time compiled (jited). This means that when you run a C# program, the byte code is compiled into native code and cached by the Common Language Runtime (CLR) (See the documentation for the ngen program for more details). Many times the compilation will remain in cache until the runtime is updated, so the compilation is only happening a single time, when the the app is started for the first time (its a bit more complicated in practice, but you get the idea.)

Theoretically this means that as new optimizations are added to the framework, or as new processor features become available, the application will be automatically re-jited into a "better" executable. This means that, theoretically, the performance of a C# or Java program can be better than a C program compiled for a generic processor.

Typically the applications that C# and Java are unsuitable for are embedded applications and realtime applications. However, this is mostly due to the way that the most common garbage collectors are non-deterministic, and does not have much at all to do with the way the languages are compiled. Additionally, applications that need to use native libraries, or access memory in very specific ways, may encounter performance problems or other obstacles when implemented in C# or Java, due to auto-boxing, pinning, etc. However this has more to do with "managed memory" and safety then with compilation.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.