An operating system is the low-level software that schedules tasks, allocates storage, and handles the interfaces to peripheral hardware, such as printers, disk drives, the screen, keyboard, and mouse. An operating system has two main parts: the kernel and the system programs. The kernel allocates machine resources, including memory, disk space, and CPU (page 928) cycles, to all other programs that run on the computer. The system programs perform higher-level housekeeping tasks, often acting as servers in a client/server relationship.
Much of the Mac OS X software is open source. Mac OS X uses the Mach kernel, many utilities come from the GNU project, and system programs come mostly from BSD code, although Apple has developed a number of new programs.
The Mach Kernel
The Mach kernel was developed as a research project at Carnegie Mellon University. CMU concluded its work on the project in 1994, although other groups have continued this line of research. The version of Mach used in Mac OS X has been under internal development at Apple for a long time, so its version numbers are not directly comparable with version numbers from the research projects.
Mach employs a microkernel architecture. While traditional UNIX systems favor a single giant kernel that contains all of the code for the operating system, Mach is a very small kernel that provides only minimal features. Other programs provide core operating system services. For example, on a traditional UNIX system the virtual memory system is part of the kernel. In contrast, under Mac OS X running the Mach kernel, parts of the virtual memory system are run by programs that are separate from the kernel.
The GNU Project
In 1983, Richard Stallman (www.stallman.org) announced the GNU Project for creating an operating system, both kernel and system programs, and presented the GNU Manifesto, which begins as follows:
Some years later, Stallman added a footnote to the preceding sentence when he realized that it was creating confusion:
The GNU Project has grown considerably since Stallman's announcement. Today GNU is run by the Free Software Foundation (FSF), which Stallman also founded.
GNU software is distributed under the terms of the GNU General Public License (GPL, www.gnu.org/licenses/licenses.html). The GPL says you have the right to copy, modify, and redistribute the code covered by the agreement. When you redistribute the code, however, you must also distribute the same license with the code, making the code and the license inseparable. If you get source code off the Internet for an accounting program that is under the GPL and modify that code and redistribute an executable version of the program, you must also distribute the modified source code and the GPL agreement with it. Because this is the reverse of the way a normal copyright works (it gives rights instead of limiting them), it has been termed a copyleft. (This paragraph is not a legal interpretation of the GPL; it is here merely to give you an idea of how it works. Refer to the GPL itself when you want to make use of it.)
Mac OS X uses the GNU C compiler, gcc, which includes a language named Objective-C. Objective-C, often called ObjC, is a reflective, object-oriented programming language. In addition, Mac OS X takes advantage of other GNU development tools.
The BSD UNIX System
In 1989, the University of California at Berkeley released parts of the BSD UNIX system under a very permissive license, requiring only that credit to the original authors be given. During the next few years, more code was rewritten without any trace of AT&T's original UNIX code in it until a reasonably complete operating system, 4.4BSD, was available for distribution. Bill Jolitz provided the few missing pieces and in 1989 began distributing 386/BSD, an operating system that ran on Intel 80386 processors. A commercial variant, BSD/OS, showed up almost immediately. In 1992, UNIX Systems Labs (the then-current owner of the UNIX license) sued, first BSDI (the vendor of BSD/OS), and then both BSDI and the University of California, over alleged copyright infringement; it took nearly two years to establish the fact that the code was clean and could be distributed.
Because Mac OS X uses many BSD utilities, it is generally considered a member of the BSD family. Unlike the other BSDs (such as NetBSD, FreeBSD, and OpenBSD), Mac OS X does not use a BSD kernel, instead using the Mach microkernel architecture.
Darwin (opendarwin.org and developer.apple.com/darwin) is the open-source release of the underlying operating system code of Mac OS X, without the user interface and some proprietary drivers. Although Apple has only sold Macintosh computers based on Motorola and IBM processors, Darwin has been running on Intel processors for years. Apple has recently announced its intent to migrate Mac OS X to Intel processors. While this book talks about Mac OS X, much of the material applies equally to Darwin.