Sunday, August 12, 2018

Managed Code V/S Unmanaged Code

Managed Code & Unmanaged Code
Managed Code:
Managed code is the code that is written to target the services of the managed runtime execution environment such as Common Language Runtime in .Net Technology. This code is directly executed by CLR with help of managed code execution. Any language that is written in .NET Framework is managed code.
In simple terms the code which is executed by CLR (Common Language Runtime) is called Managed Code, any application which is developed in .Net framework is going to work under CLR, the CLR internally uses the Garbage Collector to clear the unused memory and also used the other functionalities like CTS, CAS etc. Managed code uses CLR which in turns looks after your applications by managing memory, handling security, allowing cross - language debugging, and so on.
Unmanaged Code:
Unmanaged code compiles straight to machine code and directly executed by the Operating System. The generated code runs natively on the host processor and the processor directly executes the code generated by the compiler. It is always compiled to target a specific architecture and will only run on the intended platform. All code compiled by traditional C/C++ compilers are Unmanaged Code.
         The managed code is comparatively easier to learn, write and manage. It offer less code writing efforts to the developer. The legacy of library concept is still maintained by the managed category. While writing an unmanaged code, the programmer works closer to the system hardware, thus faces security and memory management issues too. Most of the modern languages under the managed class have been written (directly or indirectly) in the unmanaged C language code. Unlike the newer, the unmanaged code does not need any supporting environment to execute. It’s ready to run just after the source code compilation.

Difference between Managed & Unmanaged Code:


No comments:

Post a Comment