473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Question on conversion from MSIL to native code

Dan
Hi Gurus

I got a very basic question to ask:

When a .NET exe (MSIL) is first run, the JIT-compiler will converts the IL
into native codes so that it can executes on the current machine. my
question is:

1) where does the native codes reside? is it saved somewhere in the hard
drive or it will only resides in the memory? or does the JIT compiler writes
the native codes into the exe?

2) Is it persistent? meaining, the JIT compiler will only need to convert
once and the native code will remain in the system even after the system is
rebooted.

regards
dan
Jul 21 '05 #1
5 5270
Hi Dan,

"Dan" <bi*******@yahoo.com.sg> wrote in message
news:OS**************@TK2MSFTNGP09.phx.gbl...
Hi Gurus

I got a very basic question to ask:

When a .NET exe (MSIL) is first run, the JIT-compiler will converts the IL
into native codes so that it can executes on the current machine. my
question is:

1) where does the native codes reside? is it saved somewhere in the hard
drive or it will only resides in the memory? or does the JIT compiler writes the native codes into the exe?
Memory, not persisted.
2) Is it persistent? meaining, the JIT compiler will only need to convert
once and the native code will remain in the system even after the system is rebooted.


Nope, not persistent. You can use NGEN utility to created native images.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
Jul 21 '05 #2
Dan
Hi Miha

thanks for the reply. If it is not persisted and resides in the memory, is
it staying in the EXE process memory. What happens when the exe is
terminated? Does it means that the MSIL will always needs to be converted to
native code each time the .NET exe is executed? or does the conversion only
happens once when the exe is first run?

thanks
dan
"Miha Markic" <miha at rthand com> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl...
Hi Dan,

"Dan" <bi*******@yahoo.com.sg> wrote in message
news:OS**************@TK2MSFTNGP09.phx.gbl...
Hi Gurus

I got a very basic question to ask:

When a .NET exe (MSIL) is first run, the JIT-compiler will converts the IL into native codes so that it can executes on the current machine. my
question is:

1) where does the native codes reside? is it saved somewhere in the hard
drive or it will only resides in the memory? or does the JIT compiler

writes
the native codes into the exe?


Memory, not persisted.
2) Is it persistent? meaining, the JIT compiler will only need to convert once and the native code will remain in the system even after the system

is
rebooted.


Nope, not persistent. You can use NGEN utility to created native images.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

Jul 21 '05 #3
Hi Dan,

"Dan" <bi*******@yahoo.com.sg> wrote in message
news:OV****************@TK2MSFTNGP12.phx.gbl...
Hi Miha

thanks for the reply. If it is not persisted and resides in the memory, is
it staying in the EXE process memory. What happens when the exe is
terminated? Does it means that the MSIL will always needs to be converted to native code each time the .NET exe is executed?
Yup.

or does the conversion only happens once when the exe is first run?


No. It happens always unless you NGEN-it.

--
Miha Markic - DXSquad/RightHand .NET consulting & software development
miha at rthand com
Jul 21 '05 #4
Dan
Hi Miha

first of all thanks for your time.

but I can clearly see a difference between the first and subsequent time
run. The subsequent executions are clearly faster than the first. I'm really
curious on what makes up the differences. I'm running it on XP Pro.

Also, I'm hesitated to use NGEN because I heard somewhere that it will
actually produced native codes for you that are very much optimized for the
machine you NGENed, so you may have performance isssues when running another
machine. Furthermore, I not sure if there is any compatibility issue, say if
I NGENed it on XP Pro(using Intel CPU), will the generated native code be
able to run on another XP Pro running on AMD CPU?

can you recomend some websites or online resources at MS for further
information? on this matter as well as for NGEN? thank you very much.

thanks
dan
"Miha Markic" <miha at rthand com> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
Hi Dan,

"Dan" <bi*******@yahoo.com.sg> wrote in message
news:OV****************@TK2MSFTNGP12.phx.gbl...
Hi Miha

thanks for the reply. If it is not persisted and resides in the memory, is it staying in the EXE process memory. What happens when the exe is
terminated? Does it means that the MSIL will always needs to be
converted to
native code each time the .NET exe is executed?


Yup.

or does the conversion only
happens once when the exe is first run?


No. It happens always unless you NGEN-it.

--
Miha Markic - DXSquad/RightHand .NET consulting & software development
miha at rthand com

Jul 21 '05 #5
Hi Dan,

"Dan" <bi*******@yahoo.com.sg> wrote in message
news:eR**************@TK2MSFTNGP12.phx.gbl...
Hi Miha

first of all thanks for your time.

but I can clearly see a difference between the first and subsequent time
run. The subsequent executions are clearly faster than the first. I'm really curious on what makes up the differences. I'm running it on XP Pro.
Maybe because assemblies are already in memory (.net didn't relase them yet)
or in cache or something.
But, they are in memory.
Also, I'm hesitated to use NGEN because I heard somewhere that it will
actually produced native codes for you that are very much optimized for the machine you NGENed, so you may have performance isssues when running another machine.Furthermore, I not sure if there is any compatibility issue, say if I NGENed it on XP Pro(using Intel CPU), will the generated native code be
able to run on another XP Pro running on AMD CPU?
Right. That's why you have to ngen them on the machine itself.
Plus, the ngenized code runs a bit slower than code that is JITed.
can you recomend some websites or online resources at MS for further
information? on this matter as well as for NGEN? thank you very much.


http://msdn.microsoft.com/library/de...etperftips.asp

http://msdn.microsoft.com/library/de...torNgenexe.asp

http://msdn.microsoft.com/library/de...tperftechs.asp

--
Miha Markic - DXSquad/RightHand .NET consulting & software development
miha at rthand com
Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Aaron | last post by:
I know when you compile a .NET app c# or vb the code is converted to MSIL. I was just wondering is it 100% reversible? If so, does that mean someone can steal all your source code just by...
3
by: NigelW | last post by:
Clarification needed please. If I compile a C++ program with the /clr option inpsection of the resulting assembly with ILDASM shows MSIL even for methods in classes for which I have not...
1
by: John Doe | last post by:
Hi all, I have a lot of confusion about what this runtime environment is. When I write an application with unmanaged code and unmanaged data, can I compile it to the MSIL, or it will compile...
7
by: Gustavo L. Fabro | last post by:
Greetings! Some classes that once compiled without problems on VS 2003 have now problems on VS 2005 Beta 1. I'm talking about a __nogc class that is exported with __declspec(dllexport). The...
5
by: Dan | last post by:
Hi Gurus I got a very basic question to ask: When a .NET exe (MSIL) is first run, the JIT-compiler will converts the IL into native codes so that it can executes on the current machine. my...
6
by: yves | last post by:
Hello, I'm trying to check if only the lsb 8 bits of an integer are used. bool Func(int x) { if ((x & 0xFFFFFF00) == 0) { return true; }
5
by: =?Utf-8?B?U2hhaWxlbiBTdWt1bA==?= | last post by:
I have some code that was written in managed C++ using VS 2005. I want to convert that code into C#. Is there a tool available to do this? Thanks in advance. -- Shailen Sukul Architect (BSc...
5
by: kelvin.koogan | last post by:
I want to declare an array of constant strings. In unmanaged C++ I'd do this static const char *string = { "One", "Two, "Three" }; However if I do this in .NET and want to pass these to a...
10
by: Number 11950 - GPEMC! Replace number with 11950 | last post by:
Hi all, Playing VS2005 was more fun than Doom III, and I do enjoy my games. Anyway, it's back to work for me and I'm bogged down in my familiar VB6 stomping grounds because I don't want my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.