找回密码
 FreeOZ用户注册
查看: 2243|回复: 7
打印 上一主题 下一主题

[业界新闻] Eric S. Raymond解析NT内核

[复制链接]
跳转到指定楼层
1#
发表于 30-1-2009 20:38:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?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

评分

参与人数 1威望 +30 收起 理由
coredump + 30 你太有才了!

查看全部评分

回复  

使用道具 举报

2#
发表于 31-1-2009 15:26:02 | 只看该作者
大部分观点很赞同,不过NT内核并不是一个烂得不可救药的东西,相反它有着高贵的血统(来源于OpenVMS) 和现代化的设计(比如,NT大获成功的微内核设计, 而Linux还是单一内核, GNU Hurd想做微内核,但是很不成功),  先进的安全控制策略 (也是来源OpenVMS的东西, 安全描述符等远比Linux/Unix的rwx的原始权限控制系统强大).
回复  

使用道具 举报

3#
 楼主| 发表于 31-1-2009 19:19:19 | 只看该作者
原帖由 coredump 于 31-1-2009 15:26 发表
大部分观点很赞同,不过NT内核并不是一个烂得不可救药的东西,相反它有着高贵的血统(来源于OpenVMS) 和现代化的设计(比如,NT大获成功的微内核设计, 而Linux还是单一内核, GNU Hurd想做微内核,但是很不成功),  先进 ...


1. 血统:非技术因素,不做讨论了 :-)

2. Microkernel vs. Monolithic Kernel:这个之争Linus和MINIX作者及两大派已经在当年的华山论剑讨论的非常充分了,有兴趣可在Google上搜:
[The Tanenbaum-Torvalds Debate]

另外值得一提的:无论是Linux还是FreeBSD,现在它们的内核都是非Microkernel非Monolithic的,而是混合型。Linux下做过驱动的人应该都用过insmod,rmmod之类的吧~ FreeBSD下的KLD机制也是非Monolithic的东东。现代的操作系统内核基本上都是混合型的了,不再像早期那么单纯。

3. 文件权限:理论上UNIX下的安全机制可以满足一切的业务需要,只是在做复杂的权限控制时,确实不够方便。不过现在好了,Linux下有SELinux,FreeBSD下有ACL,都是比NTFS+NT强得多的东东。这里面强的是指:它是直正的内核相关的安全机制,而不像Windows下的安全机制,基本上都是上层建筑:门都是纸糊的吓唬人的。内核本身无安全机制可言(连内存空间和进程间通信都不是安全的,对于玩汇编的人。。。)

不过,Windows还是商业上很成功地,无疑M$是盗版和OEM的最大受益者,
如果使用Windows需要花几千RMB,不知道还会有几个普通用户用它 :-D
回复  

使用道具 举报

4#
发表于 31-1-2009 23:50:03 | 只看该作者
1. 血统:非技术因素,不做讨论了 :-)


2. Microkernel vs. Monolithic Kernel:这个之争Linus和MINIX作者及两大派已经在当年的华山论剑讨论的非常充分了,有兴趣可在Google上搜:
[The Tanenbaum-Torvalds Debate]

这已经是很久远的事情了....
另外值得一提的:无论是Linux还是FreeBSD,现在它们的内核都是非Microkernel非Monolithic的,而是混合型。Linux下做过驱动的人应该都用过insmod,rmmod之类的吧~FreeBSD下的KLD机制也是非Monolithic的东东。现代的操作系统内核基本上都是混合型的了,不再像早期那么单纯。

agree! 理论上的真正微内核可能只有L4才算了。
3.文件权限:理论上UNIX下的安全机制可以满足一切的业务需要

这个能详细说说看吗?
只是在做复杂的权限控制时,确实不够方便。不过现在好了,Linux下有SELinux,FreeBSD下有ACL,都是比NTFS+NT强得多的东东。这里面强的是指:它是直正的内核相关的安全机制,而不像Windows下的安全机制,基本上都是上层建筑:门都是纸糊的吓唬人的。内核本身无安全机制可言(连内存空间和进程间通信都不是安全的,对于玩汇编的人。。。)

SELinux 我也很喜欢, NSA的大手笔。不过NT的安全机制也没有你说的这么不堪。
回复  

使用道具 举报

5#
 楼主| 发表于 1-2-2009 00:54:59 | 只看该作者
哈哈,现在NT内核通过不断的patch,深层次的安全问题(进程间内存隔离)应该是没有了,已经7年没用Windows了,不是很了解了。不过觉得Windows下的上层建筑:AD,NTFS,注册表,都是无安全可言的,极易被病毒攻击的。另外Windows的DLL库机制也是一个不小的安全漏洞,这些问题是系统设计的问题,通过补丁解决不掉,先天不足。

做为一个服务器操作系统,可能除了极有钱的大企业,一般小公司用不好Windows,也维护不起,需要的人力物力太多了。Linux/UNIX 在国内的企业应用,可能更需要时间,因为国内大部分的IT人还只是停留在对开源产品的“使用”上。觉得开源产品的好处就是“免费”,但是需要很“专业”。对开源产品的整个运作模式都不了解。习惯了出问题,打电话,找客服。用Linux,遇到问题,可能少有人懂得去邮件列表上问,估计都会在Google上搜,搜不到就是一遍一遍地试(用Windows形成的坏习惯,因为Windows本身有很多BUG,有时候正确的操作,很出错,多操作几遍可能莫名其妙又好了)。

其实现在大家用Windows,很多情况都不是因为Windows本身,而是因为QQ,CS,网游,暴风影音。。。吧~~ :-D 否则估计没人会愿意用一个整天打补丁,动不动死机,周期重装,定期排毒,整理碎片的系统吧 :-D

不说非技术的东西了,文件权限的话,因为有Group,而且允许一个用户属于多个Group,因此理论上可以实现任何的分隔,但对于复杂的情况(比如俺公司的情况,Linux下有四种角色,干不同的事)就是非常麻烦。这类情况,还是SELinux的好。 :-D

[ 本帖最后由 lwnxx 于 1-2-2009 00:57 编辑 ]

评分

参与人数 1威望 +30 收起 理由
ubuntuhk + 30 谢谢分享!

查看全部评分

回复  

使用道具 举报

6#
发表于 1-2-2009 01:09:20 | 只看该作者

回复 #5 lwnxx 的帖子

Linux/Unix的权限管理的瓶颈不在group上,而是所有权限都是r,w,x; 对于现代操作系统来说,这样的权限分类太过原始了,OpenVMS 10几年前都已经具备了现在WINDOWS NT DOMAIN那样完整的安全描述符实现了,SELinux, TrustedBSD, OpenSolaris的FMAC这些实现都是在弥补UNIX权限管理的不足,同样是在打补丁, 而且用的不广泛,大量的服务器还是使用简单的rwx管理方式。
回复  

使用道具 举报

7#
发表于 1-2-2009 01:30:50 | 只看该作者

回复 #5 lwnxx 的帖子

lwnxx也是*nix高人
回复  

使用道具 举报

8#
发表于 1-2-2009 01:53:26 | 只看该作者

回复 #7 ubuntuhk 的帖子

看名字就知道了
回复  

使用道具 举报

您需要登录后才可以回帖 登录 | FreeOZ用户注册

本版积分规则

小黑屋|手机版|Archiver|FreeOZ论坛

GMT+11, 4-3-2025 23:32 , Processed in 0.043716 second(s), 25 queries , Gzip On, Redis On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表