Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1308687
  • 博文数量: 273
  • 博客积分: 5865
  • 博客等级: 准将
  • 技术积分: 3280
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-11 10:01
文章分类

全部博文(273)

文章存档

2015年(33)

2014年(11)

2013年(11)

2012年(136)

2011年(32)

2010年(50)

分类: 系统运维

2011-04-20 14:33:27

 

Introduction to MINIX3

MINIX3简介


How often have you rebooted your TV set in the past year? Probably a lot less than you have rebooted your computer. Of course there are many "reasons" for this, but increasingly, nontechnical users don't want to hear them. They just want their computer to work perfectly all the time and never crash. MINIX 3 is a project to develop an operating system as reliable as a TV set, for embedded systems and mission critical applications, but also for future $50 single-chip laptops and general desktop use. The focus is being small, simple, and reliable. Note: This is the last entry for the Alternative OS Contest.

过去你重启电视机有多频繁? 可能远比重启你的计算机少吧. 当然, 虽然这是由多方面”原因”所致, 但非技术用户从不希望听这些解释. 他们只希望自己计算机能很好地工作永不崩溃. MINIX3是这样一项工程: 不仅为嵌入式系统, 重要任务应用, 而且还包括未来售价仅$50的单芯片手提电脑和普通桌面等用途开发像电视机一样可靠的OS. 它关注的是小巧, 简单, 可靠等. 注意: 这是可选OS内容的最后一项.


History

历史


MINIX 3 has a bright future but somewhat checkered past. The first version, MINIX 1, was released in 1987 and was the first UNIX clone with all the source code available. It developed rapidly and soon had its own USENET newsgroup (comp.os.minix), with 40,000 subscribers within 3 months, a large number at a time when the Internet was only available to university researchers and students. One of the early MINIX adopters was a Finnish student named Linus Torvalds, who went out and bought a PC just to run MINIX, studied it very carefully, and then decided to write his own operating system, inspired by MINIX. Although Linus knew MINIX very well, he didn't steal any code from it, as some people have alleged. Linus system grew into the modern Linux system. MINIX' author, Andrew Tanenbaum and Torvalds have had some fairly public discussions on operating system design, originally in and most recently in .

MINIX3未来一片光明, 但它也有坎坷的过去. 第一版, MINIX1, 发布于1987, 它是第一个完全自主代码的UNIX克隆. 它发展迅速, 很快就拥有属于自己的新闻组(comp.os.minix), 3个月内订阅用户数达到4W, 这个数目在当时互联网仅在大学中研究人员和学生间使用的时代已经是非常巨大的数字了. 早期使用MINIX的那批用户之一就有芬兰的学生Linus Torvalds, 他为运行MINIX特意买了台计算机, 在仔细研究MINIX, 突获灵感, 决定开发一个属于他自己的OS. 虽然 LinusMINIX了如指掌, 但他并不像有些人指责的那样剽窃MINIX的代码. 他的OS逐渐成长为现在的Linux系统. Andrew TanenbaumTorvaldsOS设计理念有些公开的讨论, 最早一次在, 最近一次在. [: I.E., Tanenbaum-Torvalds DebateTanenbaum-Torvalds Debate: Part II]


Rebirth

重生


Although MINIX was (and still is) widely used used for teaching operating systems courses at universities, it got a new impetus in 2005 when Tanenbaum assembled a new team of people to completely redo it as a highly reliable system. MINIX 3 has some history with MINIX 1 and MINIX 2 (released in 1997 as a POSIX-conformant OS), but it is really a new system (analogous to the relationship between Windows XP and Windows 3.1).

尽管MINIX曾经(现在也是)广泛被用于大学教授OS课程, Tanenbaum2005年组建了一个新团队为实现高可靠系统完全重写了MINIX. 虽然MINIX3MINIX1MINIX2(符合POSIX规范的OS, 发布于1997)有着千丝万缕的历史关系, 但它是一个全新的系统(类似于WinXPWin3.1的关系).


Various studies have shown that software broadly contains something like 6-16 bugs per 1000 lines of code and that device drivers have 3-7 times as many bugs as the rest of the operating system. When combined with the fact that 70% of a typical operating system consists of device drivers, it is clear that device drivers are a big source of trouble. For Windows XP, 85% of the crashes are do to bugs in device drivers. Obviously, to make OSes reliable, something has to be done to deal with buggy device drivers. Building a reliable system despite the inevitable bugs in device drivers was the original driving force behind MINIX 3.

各种研究表明软件普遍存在如下规律: 1K行代码包含616Bug, 设备驱动程序中的Bug数是OS其余部分的37. 再思考如下事实: 典型OS70%是设备驱动程序. 这就很容易得出如下结论: 设备驱动程序是主要的出错源. 显然, 要让OS可靠, 需要对Bug丛生的设备驱动程序做点什么. 创建可靠系统需要”隐藏”设备驱动程序中无法回避的Bug, 这就是MINIX3背后的指导方针.


Design

设计


The approach that MINIX 3 uses to achieve high reliability is fault isolation. In particular, unlike traditional OSes, where all the code is linked into a single huge binary running in kernel mode, in MINIX 3, only a tiny bit of code runs in kernel mode--about 4000 lines in all. This code handles interrupts, process scheduling, and interprocess communication. The rest of the operating system runs as a collection of user-mode processes, each one encapsulated by the MMU hardware and none of them running as superuser. One of these processes, dubbed the reincarnation server [: 译为轮回服务, 这是一个后台服务进程. 当某个服务出错时, 在轮回服务的帮助下出错的服务能自动重新运行], keeps tabs on all the others and when one of them begins acting sick or crashes, it automatically replaces it by a fresh version. Since many bugs are transient, triggered by unusual timing, in most cases, restarting the faulty component solves the problem and allows the system to repair itself without a reboot and without the user even noticing it. This property is called self healing, and traditional systems do not have it.

MINIX3为了构架出高可靠性的OS采用了故障隔离的方式. 传统的OS把所有的代码链接到一个巨大的运行在内核模式的二进制文件中, 事实上, MINIX3与之截然不同, 它只有很小部分代码运行在内核模式 – 总共约4K行左右. 这些代码处理中断, 进程调度, 进程间通信等. 余下的OS代码为用户模式下的进程代码, 各个进程都由MMU(Memory Management Unit)硬件所独立开且无需超级用户权限就能正常运行. 任何设备驱动进程出错时, 在轮回服务的帮助下, 出错的进程都能自动重新运[: 服务层位于设备驱动层上, 为什么驱动出错, 还可以通过轮回服务来恢复呢?]. 由于进程Bug只在该进程所分得的时间片内才会表现出来, 因此, 在绝大多数情况下, 重运行出错的组件是可以解决问题, 甚至用户都不会察觉到有出错, 这让系统无需重启就能自我修复. 这就是所谓的自康复, 传统系统不具备该特性.


The structure of MINIX 3 is shown in Fig. 1. It is constructed as a series of layers. At the bottom, running in kernel mode, is a microkernel, consisting of about 3000 lines of C and 800 lines of assembler. Above that comes a layer of device drivers, with each driver in a separate user-mode process to ease in replacing it should it fail. Then come the servers, which form the core of the operating system. These include the reincarnation server mentioned above, the file server, the process manager, and others, including the X server, the data store, and various others. Finally, on top of that come the user processes. Although internally, MINIX 3 is completely different from other UNIX systems, it supports the standard POSIX interface to applications, so normal UNIX software can be ported fairly easily.

MINIX3的结构如图1所示. 它由多层构成. 最底层运行在内核模式下, 这是由3KC代码和800行汇编代码所组成的微内核. 往上是设备驱动层, 各个驱动运行在用户模式下独自的进程地址空间内, 方便当其出错时被清除替换. 再往上是服务层, 该层为OS的核心层, 它包括了: 前面提过的轮回服务, 文件服务, 进程管理, X服务, 数据存储等. 最上层为用户进程. 虽然MINIX3内部与UNIX截然不同, 但它支持应用程序的POSIX接口规范, 所以很容易把常见的UNIX软件移植到MINIX3.

Fig. 1. The MINIX 3 architecture

1. MINIX3的构架


The components communicate by passing fixed-length messages. For example, a user process requests file I/O send sending a message to the file server, which then checks its cache and if the needed block is not present, sends a message to the disk driver process to go get the block. While sending a message adds a little bit of overhead (about 500 nsec on a 3-GHz Pentium 4), the system is still quite responsive. For example, a complete system build, which requires over 120 compilations, takes well under 10 sec.

组件间通过发送定长消息进行通讯. 例如, 一个用户进程发送一条消息给文件服务来请求文件I/O, 文件服务查看高速缓冲中是否有所需块, 若无则向磁盘驱动进程发送获取该块的请求. 当然, 发送消息是有开销的(奔四3GHz的芯片约需500纳秒), 但系统还是能很快响应. 例如, 建立一个完整的系统需要120次编译, 这在10秒内就可以完成.


User View

用户预览


From the user's point of view, MINIX 3 looks like UNIX, except less bloated. It comes with the X Window System and over 400 standard UNIX programs, including:

  • Shells: ash, bash, pdksh, rsh

  • Editors: emacs, nvi, vim, elvis, elle, mined, sed, ed, ex

  • Language tools: cc, gcc, g++, bison, flex, perl, python, yacc

  • Programming tools: cdiff, make, patch, tar, touch

  • Networking: ssh, telnet, ftp, lynx, mail, rlogin, wget, pine

  • File utilities: cat, cp, bzip2, compress, mv, dd, uue, GNU utilities

  • Text utilities: grep, head, paste, prep, sort, spell, tail

  • Administration: adduser, cron, fdisk, mknod, mount, cvs, rcs

  • Games: dungeon, nethack

从用户角度来看, MINIX3很像UNIX, 除了不那么臃肿. MINIX3X窗口系统和超过400[: 现已超过650]个标准UNIX程序:

  • Shell: ash, bash, pdksh, rsh

  • 编辑器: emacs, nvi, vim, elvis, elle, mined, sed, ed, ex

  • 语言工具: cc, gcc, g++, bison, flex, perl, python, yacc

  • 编程工具: cdiff, make, patch, tar, touch

  • 网络: ssh, telnet, ftp, lynx, mail, rlogin, wget, pine

  • 文件实用工具: cat, cp, bzip2, compress, mv, dd, uue, GNU utilities

  • 文本实用工具: grep, head, paste, prep, sort, spell, tail

  • 系统管理: adduser, cron, fdisk, mknod, mount, cvs, rcs

  • 游戏: dungeon, nethack


Currently the user interface is just X, but someday a GUI may be added if a suitable lightweight GUI can be found. Here are some .

当前的用户界面仅有X, 但以后如果有适合的轻量级的GUI那么MINIX3也是会采用的. 这有些.


Availability

有效性


MINIX 3 is open source software, under the BSD license. It has its own Website from which the a bootable CD-ROM image containing all the sources and binaries can be downloaded. To install it, just boot the CD-ROM, login as root, and type: setup. Installation takes about 10 minutes. After installation, a large number of packages can be installed from the CD-ROM or the Website by just typing: packman to select the choices. Currently MINIX 3 runs on x86 hardware, but ports to the PowerPC and Xscale are underway. It also runs fine on virtual machines such as VMware and Xen.

MINIX3是一款采用BSD授权协议的开源软件. 它有自己的网站, 从引导光盘镜像到所有源码和二进制文件都可下载. 安装时, 只需光盘引导, root身份登陆, 键入setup即可. 安装约需10分钟, 之后, 键入packman从光盘或网站上选择安装各类软件包. 当前MINIX3只能运行在X86平台上, 但我们已经开始将其移植到 PowerPCXscale平台上. MINIX3也可以在像是 VMware Xen这样的虚拟机上正常运行.


Since MINIX 3 went public in late 2005, the Website has had over 300,000 unique visitors and the CD-ROM image has been downloaded some 75,000 times. Currently, the site is getting over 1000 visitors a day. There is an active Google USENET newsgroup, comp.os.minix, where people ask and answer questions, post new software, and discuss MINIX 3. MINIX 3 is a community effort and your help is most welcome. Go get the system, try it out, and join the future.

MINIX32005年底向公众发布以来, 官网独立访问人数已达30W, 光盘镜像下载量已达7.5W. 当前的日访量为1K. 是一个活跃的Google新闻组, 大家可以在此提出问题和解答问题, 发布新软件, 讨论MINIX3. MINIX3关注社区的意见, 非常欢迎您的加入. 去下载安装试试吧, 请加入我们.

阅读(2016) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~