马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?FreeOZ用户注册
x
Eric S. Raymond解析NT内核
Eric S. Raymond - Open Source概念的提出者(Open Source一词首次被明确完整地定义于他的Cathedral & Bazaar一书,网上有免费的全文),Open Source Initiative创建者,早期AT&T UNIX内核研究人员。Netscape公司及产品被Microsoft捆绑IE干掉后,由Eric S. Raymond提出的开源商业模式转型为Mozilla基金会,并推出产品:Firefox。
本文摘自The Art of UNIX Programing,深入探讨NT内核做为服务器系统的十宗罪,带有我的简单翻译及我的简单评论 :-) Happy sharing!
Windows NT
Windows NT (New Technology) is Microsoft's operating system for high-end personal and server use; it is shipped in several variants that can all be considered the same for our purposes. All of Microsoft's operating systems since the demise of Windows ME in 2000 have been NT-based; Windows 2000 was NT 5, and Windows XP (current in 2003) is NT 5.1. NT is genetically descended from VMS, with which it shares some important characteristics.
NT内核简要的发展史,自2000后成为高低端Windows产品的通用内核。
NT has grown by accretion, and lacks a unifying metaphor corresponding to Unix's “everything is a file” or the MacOS desktop.[33] Because core technologies are not anchored in a small set of persistent central metaphors, they become obsolete every few years. Each of the technology generations — DOS (1981), Windows 3.1 (1992), Windows 95 (1995), Windows NT 4 (1996), Windows 2000 (2000), Windows XP (2002), and Windows Server 2003 (2003) — has required that developers relearn fundamental things in a different way, with the old way declared obsolete and no longer well supported.
NT内核的成长模式为“往上堆”。与Unix的"everything is 文件”不同(用过linux的都知道,everything is file in linux),也不同于MacOS的桌面理念。而NT核心没有锚在一个稳定的小块上,每隔几年就会“obsolete”一次,即过时一次,大幅的升级,大块的重写。每一次的升级: DOS (1981), Windows 3.1 (1992), Windows 95 (1995), Windows NT 4 (1996), Windows 2000 (2000), Windows XP (2002), and Windows Server 2003 (2003),都需要重新学习一些非常底层,基础的东西。(从DOS1.0玩起的,对这话应该太有感触了)
There are other consequences as well:
这种哲学的一系列后续影响:
The GUI facilities coexist uneasily with the weak, remnant command-line interface inherited from DOS and VMS.
图形界面与以前的DOS不自然地共存。
Socket programming has no unifying data object analogous to the Unix everything-is-a-file-handle, so multiprogramming and network applications that are simple in Unix require several more fundamental concepts in NT.
Socket编程没有统一的数据对象(没月UNIX下一切皆文件的设计架构),因此在UNIX下最基本的网络及进程间通信,在NT下变得不那么“基本”。
NT has file attributes in some of its file system types. They are used in a restricted way, to implement access-control lists on some file systems, and don't affect development style very much. It also has a record-type distinction, between text and binary files, that produces occasional annoyances (both NT and OS/2 inherited this misfeature from DOS).
NT有一些文件属性及相关控制,但极其有限。
Though pre-emptive multitasking is supported, process-spawning is expensive — not as expensive as in VMS, but (at about 0.1 seconds per spawn) up to an order of magnitude more so than on a modern Unix. Scripting facilities are weak, and the OS makes extensive use of binary file formats. In addition to the expected consequences we outlined earlier are these:
进程间通信在NT内核下非常昂贵。接受脚本编码能力很弱(用过BASH和MS的.BAT文件的,都应该理解这句话)
Most programs cannot be scripted at all. Programs rely on complex, fragile remote procedure call (RPC) methods to communicate with each other, a rich source of bugs.
RPC一堆BUG。
There are no generic tools at all. Documents and databases can't be read or edited without special-purpose programs.
没有统一好用的工具(不过Perl,Python都跨平台了,但Sed,Awk,Bash呢?)
Over time, the CLI has become more and more neglected because the environment there is so sparse. The problems associated with a weak CLI have gotten progressively worse rather than better. (Windows Server 2003 attempts to reverse this trend somewhat.)
CLI很弱(什么是CLI?),CMD就是CLI~~。
System and user configuration data are centralized in a central properties registry rather than being scattered through numerous dotfiles and system data files as in Unix. This also has consequences throughout the design:
系统与用户配置往在集中的中央仓库中,而不是像UNIX那样,分散在各自独立的配置当中(指的是注册表,中央的配置,一般都是只读的,全世界唯一的可写的中央仓库就是MS的这两个东西,还有一些IBM的产品,这种东西,用在服务端产品的设计上是很可怕的,原因见下面),这就导致下述问题:
The registry makes the system completely non-orthogonal. Single-point failures in applications can corrupt the registry, frequently making the entire operating system unusable and requiring a reinstall.
注册表使整个系统不能做到non-orthogonal(太地道的英文了,我翻译成,注册表使整个系统完全地搅混在一起),单点失败会破坏掉整个注册表,从而干掉整个系统(病毒的温床)。
The registry creep phenomenon: as the registry grows, rising access costs slow down all programs.
注册表是可写的!随着时间的推移,注册表越来越大,系统越来越慢,周期重装!
NT systems on the Internet are notoriously vulnerable to worms, viruses, defacements, and cracks of all kinds. There are many reasons for this, some more fundamental than others. The most fundamental is that NT's internal boundaries are extremely porous.
NT系统的网络能力臭名昭著,就是worms, viruses, defacements, and cracks及一切坏东西的温床。原因很多,最根本的:NT内核的边界不清,漏洞百出(下面有详细解释,什么叫内核边界不分)
NT has access control lists that can be used to implement per-user privilege groups, but a great deal of legacy code ignores them, and the operating system permits this in order not to break backward compatibility. There are no security controls on message traffic between GUI clients, either,[34] and adding them would also break backward compatibility.
NT具有安全控制能力,但很多遣留下来的系统代码忽略这些安全控制的代码(Oh My God)。图形界面的进程间通信无安全可言(用过MFC的都知道是什么意思吧?一个Hook可以成为上帝)。
While NT will use an MMU, NT versions after 3.5 have the system GUI wired into the same address space as the privileged kernel for performance reasons. Recent versions even wire the webserver into kernel space in an attempt to match the speed of Unix-based webservers.
NT使用Intel处理器的一些高级单元,如MMU,NT > 3.5版本的内核,将一些GUI相关的代码嵌入内核空间(??),有证据表明,最近的NT内核,还将IIS服务器的代码直接写进Kernel,为的是和现代Linux/UNIX系统具有可比性。
后面的不翻了,大家有兴趣可以看看。为什么DOS/Windows这么烂,却这么成功?已经分析的很透了,请看这两篇:
http://zhidao.baidu.com/question/16055413.html?fr=qrl
http://www.readfree.net/htm/200810/4659860.html |