oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button OS X Brings Unix Stability to the Mac

by Michael J. Norton

Related Articles

Writing a Speech Recognition App. in Carbon

Connecting PCs to Apple's Wireless Airport

Mac OS X Terms and Definitions

I've always been intrigued by Macintosh hardware, ever since I owned my first Mac 512K. I fondly remember popping open the case and making mods for the 4MHz beast to run with a Motorola 68010 at a whopping 10MHz. For some reason my most creative coding has always been on the Macintosh platform. There is something about this little machine that inspires me to create. I can sum up my relationship with my Macintosh as a love-hate relationship. There are times when I truly love my Macintosh, and there are times when I truly hate it.

I abandoned my 512K, which is still lying around my house, and went over to the Intel side of the world, only to later make friends with a Centris 640 Mac on which I created more interesting code.

After another flirtation with an Intel machine, I picked up a 7500 PowerPC when Linux became available and fell in love with the Mac once again. As I look back, what drove me away from the Macintosh were the inadequacies of the operating system.

These OS inadequacies dampened my desire to purchase new hardware that I did find appealing. For example, rather than buying a Blue and White G3, I opted to upgrade my PowerPC. Why not? For a few hundred dollars I got my old 7500 to operate at 400 MHz with a G3 chip. It ran Linux perfectly fine, so there was no real reason to buy a new box -- even if it was an attractive aqua and ice gem with a drop-down motherboard. Besides, there were rumors surfacing that Apple was looking at a Unix kernel.

Horse of a different color

Superficially, when you migrated from Mac OS 7.1 to Mac OS 8.5 and then to Mac OS 9, there were no significant differences among the revisions. The user interface looked and felt the same. Sure, new advances came along, such as a Java runtime environment and better disk utilities, but there were no milestone improvements to speak of. The migration from Mac OS 9 to Mac OS X, however, will change all of that. OS X will be a major and long-overdue stepping-stone in Macintosh operating system architecture.

Mac operating systems prior to OS X used a "time-slice architecture," where every application is allotted time to the processor.

The details of the Mac OS X kernel are a little tricky to find but there's a great PDF document at Apple's web site, Inside Mac OS X: Kernel Environment, which reveals the internal workings of the new operating system. The information in this paper defines the significant differences between Mac OS 9 and Mac OS X. From a high level looking down, Macintosh operating systems prior to Mac OS X used a "time-slice architecture," where every application is allotted time to the processor. The applications in this environment are required to cooperatively share processor time. Furthermore, the memory is unprotected. That is, an application could write into critical memory space that may be in use by the operating system kernel. The result is the infamous bomb alert on the desktop with the button highlighted for restart.

Mac OS X brings to the table a preemptive multitasking system. This means the kernel schedules time to each (process) application and governs how much time it is allotted. The kernel will also assign address space to the application. The application will not be allowed to write outside of this without the kernel taking action. This protected memory environment will change everything for Mac users.

Enter Darwin

During the past three years, rumors were circulating about what the next generation Macintosh operating system would look like. There was no doubt that the underlying OS would have to be some flavor of Unix. Much of this speculation began in 1995 when Apple was perceived to be sinking, and it appeared that Sun Microsystems would purchase the floundering company and build the Sparcintosh.

Meanwhile, Steve Jobs was enlisted to help save the listing ship, and people began to speculate that his NextStep architecture would be used for the new operating system. And if those possibilities weren't interesting enough, off on the side was yet another group inside Apple looking at the microkernel of Linux, MkLinux to buoy their fate. Apple even went as far as providing developer releases of MkLinux on their web site up until early 1999.

Then an operating system called Darwin emerged from Apple. This OS is based on FreeBSD, 4.2BSDLite, and Mach 3.0, with much of the early work taken from NetBSD. A Mach microkernel is an abstract layer for porting operating systems. Darwin is Apple's kernel environment, which handles inter-process communication (IPC), I/O, memory management, and scheduling. So what does Darwin have to do with Mac OS X?

The microkernel, recall, is an abstract layer -- it's handling messaging and scheduling. It's not interested in user windows and mouse clicks. We have another layer higher up for this. Darwin does, however, include the command line interface of BSD, as does Mac OS X. On top of Darwin are more abstract layers, core services, applications, and a large portion of FreeBSD services, plus the Carbon window environment. This entire bundle of software abstractions is what Apple calls Mac OS X.

Seeing Aqua

Apple has made it perfectly clear that they are moving away from their classic Apple window architecture. The Apple menu bar has

Mac OS X pulldown menus display more of a Motif or X-window feel, but with Apple designer flair.

been replaced with application-specific menu bars. These pull-down menus give the environment more of a Motif or X-window feel, but with an Apple designer flair. The appearance of the new operating system definitely has Apple's graphic-designer market in mind. Icons are now 32-bit color and use alpha channels to allow for transparency. Window-specific dialog boxes are now sheets that appear from the title bar of the application window. These changes are covered in the document, Adopting the Aqua Interface.

Pages: 1, 2

Next Pagearrow