Computing.Net > Forums > Programming > what exactly is a managed code??

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

what exactly is a managed code??

Reply to Message Icon

Name: secrets
Date: September 14, 2005 at 23:19:03 Pacific
OS: Windows
CPU/Ram: 2.4HT
Comment:

could any body explain what exactly is managed code and unmanaged....



Sponsored Link
Ads by Google

Response Number 1
Name: Chi Happens
Date: September 15, 2005 at 05:33:12 Pacific
Reply:

Managed code is code that runs under the CLR (Common Language Runtime). CLR is kinda like a Virtual Machine that allows all languages to have common types and objects. All .NET languages that are written using managed code run under the CLR they compile to MSIL (Microsoft Intermediate Language) which looks a lot like assembly.

Unmanaged code is code that does not run under the CLR. This could be C++ or C# that is using the UNSAFE directive.


Hope this helps some,
Chi

They mostly come at night...mostly.


0

Response Number 2
Name: secrets
Date: September 15, 2005 at 13:27:50 Pacific
Reply:

hmm! chi no this is not what i am looking for.
i read that managed code is that whoes memory management is done by CLR. right so that is called Managed code... while other is not....
any further difference ??


0

Response Number 3
Name: anonproxy
Date: September 15, 2005 at 21:22:06 Pacific
Reply:

The CLR is just a runtime with machine-like interfaces (as stated, a virtual machine). Managed code is an advanced form of memory-managed. Traditional management is based on allocation and deallocation, sometimes with garbage collection thrown in (which of course the CLR has). We could end the definition here, but that would not really tell us what is functionally happening.

The CLR (and any virtual machine - check out LISP) can deconstruct code, analyze it in pieces, and then reconstruct it with performance, security, and system-specific considerations. This partly accomplished through JIT compiling and party through a sophisticated object system. The overall effect is that there is greater 1) code reuse, 2)security considerations can be verified pre-execution, 3)optimizations can be centralized at the system level, and 4) programming languages and libraries become interfaces.

Some other benefits:

- Memory management is the easiest place for a programmer to introduce bugs into the program. It is basically a fact that all programs have bugs, so if we can eliminate or mediate a major problem domain, that's a good thing. This is a step towards true software engineering, in my opinion (and better code reuse).

- Security now takes a step towards a true policy-focus. That is, we can make general statements about what all programs (in our CLR) can and cannot do. This includes checks for possible problems or simply permissions mechanisms pertaining to what certain system components can and cannot do (not user-level priveleges - I mean an internal privelege structure). Now the concept of trusted code can take on a level granularity in regards to individual objects or functions and abstract components of a system. One change of policy that all parts of the system implicitly know at runtime. Sysadmins, for example, could know that the programs running obey the policies they have enforced in a central policy component. I am not aware this sort of setup is really out there (you could certainly do it yourself), but I suspect Microsoft will be the first to establish it.


0

Response Number 4
Name: secrets
Date: September 16, 2005 at 02:47:26 Pacific
Reply:

anonproxy! a beautiful explaination...that helps alot..can you please proivde me some ref. for further reading.


0

Response Number 5
Name: anonproxy
Date: September 17, 2005 at 00:00:52 Pacific
Reply:

The sarcastic answer to your request is to say "go build your own crippled version of lisp." (There's this running half-joke that languages - VM-based ones in particular - are simply trying to recreate LISP, but they always screw it up. So the joke goes, this is the only way most people learn about LISP - from failing to recreate it. There's double irony in telling someone to go do this anyway. Hackers have very complex humor.)

Seriously though, memory management is a big issue. Typically it is talked about in the context of a particular program, problem domain, or set of algorithms. So you need to work on summarizing lots of material if you want to get anywhere.

Somethings you can look at:

- MSDN article on the CLR (1.x). The details are not too important, but notice how the code is deconstructed and analyzed. Look for what extends traditional compilation. This is the only reason I ever read MSDN. Also check out this article on CLR memory management.

- Read a PDF about IBM's JIT implementation. (File is almost 1MB). Look for similarities between this and a static compiler. IBM is a great resource for free technical writing, incidentally (journals and developer works). It's all free.

- For a memory management glossary, visit The MemoryManagement website. Just browsing the glossary is educational. This may sound crazy, but I get so many ideas from simply glossing over things like this. Think of it as a free service - someone has taken the time to sort important concepts for you into small pieces. If something interests you, Google tells all.


0

Related Posts

See More



Response Number 6
Name: secrets
Date: September 17, 2005 at 01:13:25 Pacific
Reply:

yep! it really does. thanks for sharing this all. it really gives some good clues for the station :)


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: what exactly is a managed code??

what exactly is an assembly in dotn www.computing.net/answers/programming/what-exactly-is-an-assembly-in-dotn/14037.html

what exactly is msdos.sys? www.computing.net/answers/programming/what-exactly-is-msdossys/11494.html

What exactly is binary file? www.computing.net/answers/programming/what-exactly-is-binary-file/6322.html