November 18th, 2009
I’m not normally much of a one for the Windows / Microsoft-bashing – I tend to just take a live-and-let-live approach – but this write-up of a Windows kernel engineer’s talk is just hideous. Highlights:
“In order to make MinWin, Microsoft had to split existing DLLs that had these unwanted dependencies, such as Kernel32.dll. The team created KernelBase.dll, which has only the base functions MinWin requires. Applications expect to find these functions in Kernel32, but they are simply forwarded to KernelBase. Kernel32 itself is outside MinWin.”
“A related problem is that Microsoft has been in the habit of combining unrelated APIs into the same DLL for performance reasons. Its solution is to create virtual DLLs, which are the API sets programmers call, but which are implemented in logical DLLs that might combine several virtual ones. A schema file that is mapped into every process tells Windows where the real API resides.”
“Microsoft observed that 15 per cent of all user-mode crashes and 30 per cent of shutdown crashes were caused by heap corruption: applications that try to access freed memory, or memory beyond what is allocated. Its solution was a feature called the Fault Tolerant Heap (FTH). If an application crashes a few times, Windows will automatically apply a shim that intercepts its memory operations. FTH will over-allocate memory, and keep a copy of freed memory so that attempts to re-read it will succeed. The user gets better reliability at the expense of performance, which suffers by up to 15 per cent or so, while buggy applications work better than you would expect.”
Windows: Fixing Things Wrong Since 1985
I’m being a bit unfair, as it does seem that Microsoft (or at least the kernel engineer in question) finally understand how hideous this is and indicates that the current slate of horrible, horrible workarounds is something of a first step in trying to move towards doing things properly. But the above is a nice illustration of how far things have gone wrong. The virtual DLLs thing made me throw up in my mouth a little bit. I hate to think what Microsoft’s attrition rate for kernel developers is; they must go through ‘em like ninepins I imagine the sight of a soon-to-be-ex-kernel developer running through the corridors, foaming at the mouth and screaming ‘NO MORE! NO MORE!!!’ is a regular occurrence around Redmond way…
I’m thinking this post would make a wonderful thing to point to when people start asking why F/OSS distributions and components tend to insist on fixing things the right way the first time, no matter how much short-term pain it involves.