Managed code

Managed code is computer program source code that requires and will execute only under the management of a Common Language Runtime virtual machine, typically the .NET Framework, or Mono. The term was coined by Microsoft.

Managed code is code written in one of over twenty high-level programming languages that are available for use with the Microsoft .NET Framework, including C#, J#, Microsoft Visual Basic .NET, Microsoft JScript .NET, and C++ while unmanaged code refers to programs written in C, Visual Basic 6 and other languages that do not need a runtime to execute.

Terminology

The distinction between managed and unmanaged code is prevalent and only relevant when developing applications that interact with the .NET Framework or other Common Language Runtime (CLR) implementations, like Mono. Since many older programming languages have been ported to the CLR, the differentiation is needed to identify managed code, especially in a mixed setup. In this context, code that does not rely on the CLR is termed unmanaged.

A source of confusion was created when Microsoft started connecting the .NET Framework with C++, and the choice of how to name the Managed Extensions for C++. It was first named Managed C++ and then renamed to C++/CLI. The creator of the C++ programming language and member of the C++ standards committee, Bjarne Stroustrup, even commented on this issue, "On the difficult and controversial question of what the CLI binding/extensions to C++ is to be called, I prefer C++/CLI as a shorthand for "The CLI extensions to ISO C++". Keeping C++ as part of the name reminds people what is the base language and will help keep C++ a proper subset of C++ with the C++/CLI extensions."[1]

Uses

Microsoft's Visual C++ development environment can produce both managed code, running under the .NET CLR, or compiled binaries, running directly on the Windows platform with the help of its C++ Runtime Library.[2]

Benefits of using managed code include programmer convenience (by increasing the level of abstraction, creating smaller models) and enhanced security guarantees, depending on the platform (including the VM implementation). Drawbacks include slower startup speed (the managed code must be JIT compiled by the VM) and generally increased use of system resources on any machine that is executing the code.

There are many historical examples of code running on virtual machines, such as the language UCSD Pascal using p-code, and the operating system Inferno from Bell Labs using the Dis virtual machine. Java popularized this approach with its bytecode executed by the Java virtual machine.

References

  1. Stroustrup, Bjarne (2009-06-29). "Bjarne Stroustrup's FAQ: What do you think of C++/CLI?". Retrieved 2009-06-29.
  2. Gregory, Kate (2003-04-28). "Managed, Unmanaged, Native: What Kind of Code Is This?". Retrieved 2009-04-22.

External links

This article is issued from Wikipedia - version of the 9/24/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.