M  E  N  U
 - Guides
 - Links
 - Tools
 - Themes


Services Utility: .NET Runtime Optimization Service v* Service

Display Name (?): .NET Runtime Optimization Service v*
Short Name (?): clr_optimization_v*
Executable (?): mscorsvw.exe
Library (?): None.
Depends On (?): None.
Supports (?): None.
Description (?): Microsoft .NET Framework NGEN
OS (?): 2000 Professional, XP Home/Professional, Vista Home/Business, 2000 Server, Server 2003, Vista Server
Startup (?):

Explanation (?):

The .NET Runtime Optimization Service (in my case v2.0.50727_X86) is a component of the Common Language Runtime. This is an expansion and a step away from just-in-time (JIT) application compilation and a protection for NGen compilation as a method for repairing fragile dependencies that have been broken by an update.

That is a fairly complex description but basically .NET is a programming architecture that is interpreted so that it can execute on multiple platforms (or at least on multiple versions of Windows). The downside of this is that it is slower since the system must interpret the code into native code so that it can execute it.

The workaround for this is just-in-time compilation where the system compiles the code before running it so that it doesn't need to constantly interpret the code. This saves times in the long term if the application runs long enough, but it can create a bulky optimization process.

The workaround for the JIT is NGen, which I can only imagine means Next Generation or something equally silly. The concept here is that the system creates a compiled copy of all desired .NET code so that when it comes to executing it then the application doesn't need to be just-in-time compiled or interpreted, which will increase the execution speed and decrease the memory requirements. The downside of this is that NGen code is fragile since it is based on linked dependencies and if these dependencies change, such as from an associated system file update, then NGen execution will fail and .NET will revert to just-in-time compilation and execution.

The workaround for this problem is this service. The purpose of this service is to perform NGen compilations on objects when dependent objects are outdated from an update. This can be triggered from an update ("ngen.exe install /queue"), manually ("ngen.exe update" from the command-line) or I would expect from a failed execution of a .NET program because of outdated NGen dependencies.

The service runs either in low priority for important compilations or in idle priority for non-important compilations. The service can also be forced to complete all optimizations in normal priority if you invoke "ngen.exe executequeueditems" from the command-line and this service will complete all optimizations left in the queue.

Once all optimizations are completed that are in the queue the service will shutdown, thus freeing up the memory and CPU time. However, it should be noted that this service will use very little CPU time in automatic mode as it is not multiprocessor aware, so it will use at most one processor, and it runs in low to idle priority meaning that most processes will take priority over it.

If this service is installed it should be left on manual since it only consumes memory when optimizing, which should only happen after a system update. If you feel the need you can place this service on disabled and no new NGen components will be updated, thus relying on JIT when fragile dependencies are broken, but I would discourage this as I have never tested it. Also, this service will only exist if the Microsoft .NET Framework is installed. If you do not use .NET applications then you could remove this using Add / Remove Programs, but that is unlikely.

Please note: The .NET Runtime Optimization Service will have display name and a short name that is representative of the version of the install .NET Runtime Redistributable. On my Windows Server 2003 installation, at least at the point of writing this, the full name of the service was .NET Runtime Optimization Service v2.0.50727_X86 with a short name of clr_optimization_v2.0.50727_X86.

Please visit /tools/services/ for the complete Services utility.