Is it possible to know adaptive optimization done in a C# application - optimization

I am curious whether it is possible to determine how/whether adaptive optimization is being in a C# application. Any pointers will be appreciated

There is no adaptive optimization in currently shipping .NET jitter versions from Microsoft. Once the machine code is generated it doesn't get altered anymore. Nor is there a sub-system that monitors code execution to provide profiling data that a 'hot-spot' optimizer could use.
You'll find an overview of jitter optimizations in this answer.

You can look at the x86 disassembly that happens at runtime with Visual Studio to see what's happened.
Deciphering it might be tough, though, since it's bytecode that's getting translated and not source code.

Related

Why do Visual Studio and Task Manager report different memory usages?

I have a program in Visual Studio which I'm debugging. It's designed to test the memory of a computer (and conveniently named RAM...).
While debugging, the amount of memory usage from that program goes up continually. Anyway, I've used the Visual Studio diagnostic tools to monitor the amount of usage. Only recently, however, have I opened up Task Manager to see it in detail; and what I saw confused me. The amount of RAM usage is significantly less than what the diagnostic tools say.
Can anyone tell me as to why this is happening?
Thanks in advance.
I know this can be a bit late but I just encountered the same problem and this link provided a bit of explanation. It seems that Task Manager displays the working set (amount of memory you use) and the Diagnostic tools from VS displays virtual memory used for storage and not shared.
I guess you found your answer but maybe others will stumble on this too and this might be helpful. Cheers! :)

Difference between Dynamic Binary Instrumentation and Analysis

I am reading about automated bug finding techniques and in (Valgrind) paper it mentions that Valgrind is a dynamic binary instrumentation framework for building dynamic binary analysis tools. This maybe a bit stupid but I am a bit confused about the naming here. What exactly is the difference between instrumentation and analysis ? (I know that they are different words but what is the difference in practice ?)
Instrumentation is collecting data. Analysis is, well, analyzing it. The reason why Valgrind mentions "dynamic" is because there are also static analysis tools that actually analyze the code without running a program whereas Valgrind analyzes a binary code while running a binary.
See also:
http://en.wikipedia.org/wiki/Instrumentation_%28computer_programming%29
http://en.wikipedia.org/wiki/Static_program_analysis
The implementation details of this automated bug-finding tool should answer your question:
You use dynamic binary instrumentation tools to instrument the source code for further analysis.
You use different algorithms or techniques to analyze the code, such as statistical debugging introduced in the article.

Which processors can run CIL

Which processors are capable of running Common Intermediate Language(CIL), formerly known as Microsoft Intermediate Language (MSIL)? Clearly any machine that can run Microsoft Windows with .net qualifies as well as machines targeted by the Mono project.
It would appear that the .NET Micro Framework has the ability to target other processors not covered by the above, but it is not clear to me that it uses CIL.
Does anyone have a list of which processors are capable of running a program in CIL and or interpreting C# directly (as the .NET Micro Framework appears to do)?
EDIT to clarify, I understand that CLI is not executed directly on the metal but rather by a a runtime engine. So for this question any processor with a runtime engine that executes CIL qualifies.
None. There is no processor that runs CIL - CIL is to my knowledge ALWAYS translated to another form of machine code.
I think there is a CIL processor "floating around" are research project, but so far not seen in the real world.
The .NET Micro Framework doesn't allow processors to interpret CIL directly. It is simply an even more lightweight interpreter that runs on embedded hardware instead of requiring a full PC architecture. It's like .NET Compact Framework but with a smaller footprint. To look at the architectures that this supports:
.NET Micro Framework Hardware
Afaik, TomTom is right.
They call it Intermediate for a reason... it is between the programmer's language and the processor's language.
An interesting thought, though - having a processor that runs CIL code.
I found two research processors that execute CIL natively much like the JOP does for Java Bytecode:
SCIL According to the paper it supports a subset of CIL, so the some portions of CIL will have to be emulated in subroutines. Honestly though the processor and paper do not look well put together.
DSP Core for Hardware Based CIL Machine This one looks more legitimate, however its designed with a very specific purpose in mind (DSP on a mobile phone).
Realize that these cores are meant for use with FPGAs. Sadly neither of them provided source code or bitfiles, so you will have to request more information from the authors if you actually want to use them.
On the .NET Micro Framework page it mentions a CLR which is what is running the CIL.
It includes a small version of the .NET CLR...
The supported platforms on mono-project.com list a few architectures.
Though be careful to test it before investing too much time.
The only guaranteed targets are those bundled with the Xamarin product.
In the past mono was missing floating point support on some ARM architectures which since has been added.

Is it possible to make an operating system using VB.NET?

Is it possible to make an operating system using VB.NET?
Yes it is possible to make an operating system using vb.net.
You've got a serious bootstrap problem. Compiled VB.NET code cannot run without the services of the CLR and the JIT compiler. Existing implementations of it (mscorwks.dll and mscorjit.dll for example) have a heavy dependency on services provided by an operating system. You'll have to write your own, that's non-trivial to put it mildly. In addition, many classes in the framework rely on P/Invoke to directly call a Windows API function. Very basic classes like Console, Control, FileStream, Socket. You'll have to replace those too. That's where Singularity was stuck last time I saw a video of it.
The "starter kit" for any project like this is Rotor. That's how Mono got started. Take a look at what your in for, focus on the Platform Adaption Layer (PAL). Needs to be written in unmanaged C/C++ in its current form though.
It has been done (well C# at least, but since they are both CLR languages...)
It's called Singularity by Microsoft Research.
http://en.wikipedia.org/wiki/Singularity_(operating_system)
https://github.com/CosmosOS :::: here is the Answer; Cosmos Allows you to develop your own kernal with c#
Yes, it is possible.
But first you will have to identify what an operating system is; and then define what would you want in your operating system? An operating system does a lot of work on the background as well as on the foreground; there are applications, memory, threading, network, ports, a separate world that make things work.
I would agree with Aviad that probably your OS may be called a .NET CLR, but thats what that would be called. An answer to your question is that it is possible provided that you define your OS and probably limit yourself to what you really require.
No!
Unless you re-define what an operating system is and make the problem fit the solution. This has been standard practice in this industry for decades. Given the right definition of Operating System, you can even use Esperanto to write it:) So what is your definition of Operating System?
Yes, but that would not be easy. Or hard, as a matter of fact. It would be insanely difficult! You would have to write a Visual Basic interpreter (in asm or c), then you would need to implement System and a lot of other CLR stuff. What you may be looking to do is create a virtual OS. This would mean that it lays over the Windows gui and acts as an interface. Good luck.

Real HLSL IDE/debugger

Are there any IDE's for developing HLSL code? The three key features I want are:
1) syntax highlighting
2) auto-complete
3) interaction debugging
Visual Studio doesn't do any of these things, and it doesn't seem that RenderMonkey or FX Composer do either.
Is there some IDE that I'm not aware of, or does one of these three IDE's actually support these features and I'm too clueless to figure out how to use them properly?
Have you actually tried ATI's RenderMoney or NVidia's FX Composer?
Both actually provide syntax highlighting. Futher more, NVidia's Cg toolkits actually allows you to enable syntaxhightling in Visual Studio with some custom setting.
As for auto-completion, I don't think it's much needed as compare to our normal programming. It's because you won't be writing a very long code for your shader programming. Shader is quite critical in that it is run on every frame generated, and every instruction require 1 to a few clock cycle to execute, thus there's always a physical limit to how long you can afford to write.
Interactive debugging is currently the limitation of GPU hardware. To actually do that, the GPU has to be emulated with our CPU, which is quite impossible considering that the REF (software rendering) device can never cop up with even obsolete GPU, what more to say about emulating shader.
Another new answer to an old question (actually 2 answers):
NShader is a Visual Studio plugin that provides syntax highlighting for HLSL / GLSL / CG. No intellisense or debugging though.
IntelliShade, mentioned already, is no longer available at the original site, but it has been mirrored here.
New answer to old question,
For debugging: NVidias Shader Debugger and it recently became free.
In the MSDev environment you can define key words and also specify 'hlsl' and 'fx' to be recognized and known files and get MSDev highlight the keywords you want.
As for the editing tools - you can use the FX composer by NVidia or RenderMonkey by ATI. If you need to debug and profile you can use their tools as well and give Pix a spin.
Take a look at Shazzam. It doesn't feature interactive debugging, but it's pretty easy to edit and refresh.
Now with Visual Studio 11 there is a "real hlsl ide and debugger". It was detailed at Game Debugging in Visual Studio 11 and is available at Visual Studio 11 Beta.