您的位置:首页 > 运维架构 > Linux

什么是Mac OS X?跟Linux有什么区别

2010-02-05 00:00 1706 查看

  什么是Mac OS X?

  By David Chisnall

  大卫·奇斯纳尔

  Feb 5, 2010

  2010年2月5日

  Article is provided courtesy of Addison-Wesley Professional

  该文章由Addison-Wesley Professional授权提供

  OS X is often misunderstood, regarded as a pretty version of FreeBSD, a microkernel, and various other things. In this article, David Chisnall, author of Cocoa Programming Developer"s Handbook, looks at what is really at the core of Apple"s operating system and where it came from.

  Mac OS X常被误解,被看作是标致版的FreeBSD,微内核,以及其他各种不同的东西。这篇文章介绍了大卫·奇斯纳尔——《Cocoa编程开发者手册》一书的作者,是如何看待苹果操作系统的核心到底是什么,以及它是由何而生的。

  I"ve read lots of claims about Mac OS X. It"s a Linux distribution (my personal favorite), it"s just FreeBSD with a pretty window manager, it"s Mach with a BSD userland, it"s just something copied from NeXT. All of these contain some grains of truth, but none of them is really accurate. In this article, I"m going to take a look at exactly what OS X is and try to clear up some of the misconceptions about it.

  我看过很多关于Mac OS X的陈述。它是一个Linux发行版(我个人喜欢的),它只是一个带有漂亮窗口管理器的FreeBSD,它是Mach系统与BSD非内核部分的结合,它只是从NeXT复制而来。所有这些陈述都包含了一定的事实,但是没有一个是完全准确的。在这篇文章里,我将会带领大家认识一下Mac OS X究竟是什么,同时会努力澄清一些关于它的错误观念。

  Part of the confusion comes from the varying terminology used to describe bits of the system. People often talk of Darwin as if it were a kernel, an analog of Linux. In fact, Darwin is closer to being an analog of a member of the BSD family; it"s a complete system including a kernel, XNU, and a set of userland applications. On top of this are the various proprietary systems that combine to form OS X.

  这些困惑一部分是源于描述系统所用的不同术语。人们经常谈论Darwin,好像它是系统内核,与Linux类似。事实上,Darwin更加近似于BSD家族成员中的一员;它是一个完整的系统,包括一个XNU内核,www.linuxidc.com以及一套外围程序(userland)。在这之上,则是各种不同的专有系统,组合在一起构成了Mac OS X。

  A Mach-O System

  一个Mach-O系统

  In the "80s, a team at Carnegie Mellon University began working on a next-generation UNIX system. Traditional UNIX systems, like the 4.2BSD system that they were using at the time, had a single process for the kernel. Everything that the kernel is responsible for was part of a single binary, with no protection between the various parts. The goal of Mach was to separate out all of the bits and provide a mechanism for joining them together.

  在上世纪80年代,卡耐基梅隆大学的一个小组开始着手研究下一代UNIX系统。传统的UNIX系统,比如当时他们使用的BSD4.2版,一个内核只有一个进程。内核所负责的每一个事物都是二进制的一部分,在各个部分之间没有保护。Mach的目标是将所有这些数据分离开,并且提供一种机制可以将其运用到所有这些数据中去。

  A full discussion of this philosophy and its advantages and disadvantages would take up much more space than I have for this article, so I"ll simplify things somewhat. The microkernel approach, taken by Mach, was not a great success. In the end, they had a version of the BSD kernel running as a process on top of their microkernel and calling down to Mach instead of executing privileged instructions.

  对于这一做法的见解,优势以及劣势的全部讨论,将会比我这篇文章长得多,所以让我来简化一下。Mach所使用的微内核的方法,并没有获得很大的成功。最后,他们使用了某一版本的BSD内核,作为进程运行在他们的微内核上层,调用Mach,而不是运行特权指令。

  This had some advantages. One was that every user on a powerful system could have his or her own, completely isolated, BSD kernel and userland. Effectively, it was an early form of paravirtualization.

  这是有一些优点的。优点之一是,强大的系统上的每一个用户,都可以拥有他/她自己的,完全独立的,BSD内核和应用(userland)。

  It also had some major disadvantages. The biggest of these was speed. On a modern system, there are some trades between speed and scalability. A modern laptop has two to four cores, and a desktop may have 16. Cheap servers are starting to have huge numbers, just as high-end servers have for a decade or so. Back in the "80s, however, when Mach was created, single-processor machines were the norm. On a modern SMP system, if you split your code up into separate processes, then you get some overhead from their communication and some speed increase from running them in parallel.

  同时,它也有一些主要的缺点。最大的缺点之一就是速度。对于一个现代系统来说,人们会在速度和可扩展性上做一些平衡。一台现代笔记本电脑,有两到四个核心,而台式机则可能会有16个。便宜的服务器开始拥有巨量的核心,如同那些十年前已经拥有巨多数量核心的高端服务器。然而,回到上世纪80年代,当Mach创建时,单处理器机器是标准。在一个现代的对称多处理系统上,如果你将你的代码分割成独立的进程,那么你会看到,进程间的数据交换会占用额外的资源,同时,进程间的平行运行也会使得速度有所加快。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Mac OS X