. NET 4.0 New features: Mscoree.dll + mscoreei.dll= less reboot (top) __.net

Source: Internet
Author: User

One time reboot=975 years

Do a little research before you start this article: How many friends like reboot. Answer a: I like, every day to reboot n times. Answer B: I don't like it, it's best not to reboot for one weeks. If there is no accident, I believe most people can be grouped into the B category, after all, very few people will be willing to interrupt their own things to do, the article, code, etc. one by one save, and then restart, wait a few minutes, and then reopen the document, Code Editor.

However, it is regrettable that the new version of the. NET installation in Vista and above (later with vista+) operating system installation is usually required to reboot, 2003,XP or below is not needed. It may be strange to see some friends here: Why does XP need not reboot, and Vista will reboot instead? It's not a bad change. To talk about this problem, we must start from Mscoree.dll. Most used. NET programming friends may not be familiar with Mscoree.dll, but, in fact, Mscoree.dll can be said to be one of the most central parts of NET/CLR. No mscoree,clr is impossible to load. When you are executing a. NET EXE, the first load is not the CLR DLL (Mscorwks.dll), but this Mscoree.dll. For more information, see my previous article: the hero behind . NET :Mscoree. DLL

Because Mscoree.dll is a core part of. NET, it is conceivable that each time you install a new version of. NET, Mscoree.dll will be updated to add new features or Fix the bug. The main problem with updates is: If Mscoree.dll is being used, how to update mscoree.dll. Before Vista, the 2003,XP, and even the previous operating system, The installer (admin can also) can rename the Mscoree.dll directly (this operation can succeed even if Mscoree.dll is being used), and then copy the new Mscoree.dll to the system directory. However, Windows Vista+,mscoree.dll is considered one of the core components of Windows and is protected by WRP (Windows Resource Protection). If you want to update it, you must update it through a mechanism called CBS (Component Based Servicing) (Note: I am not familiar with these installation-related techniques and if there are errors in the detail description). Although this mechanism is more secure and robust, there is also a limitation: if the Mscoree.dll is in use, the system must reboot before it can complete the Mscoree.dll update. In other words, in Windows vista+, install 3.5,4.0,5.0,6.0, ... . NET has to be restarted every time. For example, 100 million users have installed NET 4.0 and need to reboot, assuming that the restart requires 5 minutes (including disk preparation), then this restart action wasted everyone 500 million minutes = 975 years ... If you take into account each. NET version of the installation to do so once, so the total time wasted can be said to be astronomical. This may be a bit alarmist, but anyway, one thing is clear: for the like. NET this kind of user group more extensive program platform (note I am talking about. NET, not SDK or vs,.net is a runtime, virtual machine, is the end user run the program used), any small detail may have a huge impact. Although. NET user base has not reached this scale, nor do we want to be affected by this problem. NET penetration.

. NET 4.0 the solution

Our goal is to reduce the number of reboots. The reboot mentioned here is a reboot to modify the MSCOREE.dll. To solve this problem, we can start with the nature of the DLL. DLLs are a code-sharing mechanism for windows that is implemented through DLL output functions, and then other exe/dll to directly invoke functions that the DLL outputs. In other words, the most important thing for an external DLL is the output function of the DLL, including its interfaces and functions. Each time the DLL is modified, it is nothing more than interface changes and functional changes. Interface changes are generally not reduced or modified because of compatibility requirements, but are increased. Functionally, the change is usually not too big, generally bug Fix, also because of compatibility requirements. Of course, except for the new features of the new interface. So is there a way to freely modify the MSCOREE.dll function and interface without having to modify the MSCOREE.dll content? It sounds like an impossible task, but when you think about it, it's not hard to realize that if we relocate the MSCOREE.DLL code to another DLL, the DLL is not constrained by Windows and can be modified freely, then the problem is solved. The answer is yes, this is the origin of MSCOREEI.dll. Of course, the details are much more complicated than the one discussed here, and this time I'm going to talk about how Mscoree and mscoreei work together. Since this project has not been completely completed, now I can not fully disclose all the details, in the right time, I will publish the sequel of this article, and for everyone to publish the answer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.