Guide to Unix/BSD/Mac OS X

The core of Apple's Mac OS X (and its predecessor NextStep) is Darwin, which contains a lot of BSD code, especially FreeBSD 5 code.

Background

edit

General

edit
  • Darwin, like other *BSD systems, is distributed as a complete Unix-like operating system, including the kernel, shell commands, C compiler, and other important utilities.
  • Darwin is different from other *BSD systems. As listed below, it has several changes that the other *BSD systems lack.
  • Darwin is named for Charles Darwin.

Kernel

edit
  • Name: The kernel is called xnu. It consists of a modified Mach microkernel and a "server" which is a port of the BSD kernel.
  • Processor architecture: Mac OS X runs on both PowerPC-, Intel- and, ARM-based Macs
  • Dualithic: The kernel uses a dualithic design. The Mach microkernel contains device drivers, multitasking, and interprocess communication. Other kernel services, such as networking, filesystems, and traditional Unix system calls, must be provided by "servers".
    • Darwin uses one server, a port of the BSD kernel. Thus networking is similar to other *BSD systems and the UFS filesystem from BSD is also available. This is in contrast to GNU Hurd, which uses a difficult design consisting of many servers.
    • NextStep probably introduced the dualithic design because Mach microkernel was more portable than BSD, or provided better multitasking benefits than BSD. They could port Mach to x86 and PowerPC. Since then, NetBSD has made *BSD very portable and created a monolithic NetBSD/macppc port. FreeBSD and OpenBSD are taking the NetBSD code for their Macintosh hardware ports.
    • Apple (before it bought NextStep) used a similar strategy to port Linux, an x86 operating system, to PowerPC. The mkLinux (microkernel Linux) project started by porting Linux/x86 to use Mach. Then Mach was ported to Macintosh hardware. After Linux 2.0 appeared, Linux was more portable and the monolithic Linux/powerpc port displaced mkLinux. Apple bought NextStep and switched to using Darwin.
    • The microkernel and server are tightly integrated. The microkernel expects the Darwin BSD server, so using another server, such as the mkLinux server, would be difficult.
  • Device drivers: Because they are handled by Mach, device drivers are much different than in NetBSD/macppc. With Darwin, Apple made many replacements to the NextStep drivers.
    • Darwin runs on any Mac the corresponding Mac OS X runs.
  • HFS+ filesystem: Darwin also contains an implementation of the HFS+ filesystem introduced in Mac OS 8.1. It does not run on the classic Mac OS file system HFS used in the Macintosh system software before Mac OS 8.1. HFS+, and not UFS, is the preferred filesystem for Darwin.

Userland

edit
  • GNU commands: Darwin replaces several BSD userland programs with their GNU equivalents; this makes Darwin feel more like GNU/Linux than BSD in several cases. In newer Darwin releases, GNU bash is the default shell, as it is on GNU/Linux.
  • NetInfo: The NetInfo database has stored user and group information since the time of NextStep. The other *BSD systems use the traditional /etc/passwd and /etc/master.passwd system instead. (The two files exist on Darwin, but typically do not contain normal users.)

Version Numbering

edit

Apple labels the Darwin source code with version numbers that match Mac OS X version numbers.

  • Jaguar: Darwin 6.v = Mac OS 10.2.v
  • Panther: Darwin 7.v = Mac OS 10.3.v
  • Tiger: Darwin 8.v = Mac OS 10.4.v
  • Leopard: Darwin 9.v = Mac OS 10.5.v

For example, the Darwin source code corresponding to Mac OS 10.4.3 is Darwin 8.3.

References

edit