OS X from a Linux Perspective

Apple’s Mac OS X has been gaining a lot of column inches in the computer press, and for good reason. As you are no doubt sick of hearing, the new Mac operating system is not just another revision of a bloated and moribund, though elegant, desktop OS. It is Unix – BSD Unix to be precise.

This is great news for Macintosh users and Linux fans alike. It allows Mac users entry into what is rapidly becoming the future of computing, Unix, and it offers Linux users the possibility of two-way software traffic. Admittedly, as Mac OS X is so new, much of this software is going to come to the Mac from the various flavours of Unix, but in time the tide may flow the other way.

Apple’s NeXT Generation OS

Apple have been scurrying around for years trying to find a suitable replacement for the aging Mac OS (hereafter referred to as the Classic Mac OS). The Classic Mac OS has always been ahead of its time in interface terms. In fact, it still is, but in other areas it had begun to lag.

It lacks preemptive multitasking, using the cooperative model instead, and also has no memory protection. The multitasking model used by Macs meant that any single greedy application could grind the rest of the system to a halt, and the lack of protected memory space for applications was another nuisance.

Though the Classic Mac OS rarely crashes (unless it’s badly configured or really pushed), it usually bring down not only the offending application, but all others and the OS itself. Not good.

Apple’s first serious attempt to rectify the situation was code named Copland. This OS never came to fruition, instead lending some elements to Mac OS 8. After this, Apple attempted to buy their way out with takeover plans for Jean Louis Gassé’s Be Inc. BeOS had all of the things Apple wanted, plus some extra bonuses such as limited POSIX compliance and a journaling file system.

The return of Steve Jobs scuppered this plan. Though Jobs and Gassé are known to be less than cordial, the main reason for the ditching of “Plan Be” seems to have been the sale of Jobs’ NeXT Software to Apple.

The NeXT Cube

The next attempt to recreate the Mac OS did bear fruit, but not how it was originally envisioned. Jobs had Apple develop a new OS based on NeXTstep, the Unix OS used in the famous black NeXT hardware. This was code named Rhapsody and was delivered to key developers such as Adobe Systems. By all accounts, they were impressed, but they felt that Jobs underestimated the difficulty they would face porting popular Classic Mac OS applications to the new system.

Apple went back to the drawing board and finally came up with Mac OS X.

Under the Bonnet

Mac OS X is Unix, but what does this mean exactly?

Anyone familiar with Jobs’ NeXT Computers will know exactly what it means. Mac OS X is attempting to be Unix for the rest of us, to paraphrase a famous Apple slogan.

The core of Mac OS X is its kernel. OS X uses a version of the Mach microkernel, developed at Carnegie-Mellon University by, among others, Apple software development guru, Avie Tevanian.

The purpose of a microkernel is to keep the bare minimum of OS components inside, pushing all other services out to external software. This kernel is wrapped up in a BSD cloak. This open source core is named Darwin.

So far so good, but not quite revolutionary.

On top of this open source work, Apple’s propriety work kicks in, and it’s here that Mac OS X really begins to give other Unix flavours a run for their money. The second layer consists of Quartz, QuickTime, and OpenGL.

Quartz is a PDF-based display engine giving the Mac OS native support for Postscript and Adobe Acrobat files, but it’s much more than that. Quartz allows the OS to use vector images in conjunction with the more usual (but memory intensive) bitmap displays. Users of the Classic Mac OS may remember Apple’s QuickDraw technology; Quartz is the replacement.

QuickTime is Apple’s cross-platform multimedia software and is doubtlessly the most complete multimedia platform available on any desktop system. However, unlike the Classic Mac OS or Windows, where QuickTime is loaded on top of the OS, it is an integral, low-level part of OS X. This should allow for lower latency in multimedia software.

The third pillar at this level, OpenGL, will be familiar to most users. Developed by Silicon Graphics, purveyors of some of the world’s most expensive computers, it is cross platform 3D standard and will allow easier porting to and from the Mac OS of 3D applications – and improve 3D performance.

Sitting astride these technologies we find the APIs. OS X has three, well two and a half, APIs: Carbon, Cocoa, and Classic. Carbon is a lean, stripped down version of the Classic Mac OS API and allows for very rapid porting to OS X from the Classic Mac OS. Software developed for Carbon will run just fine under Mac OS 9.

Cocoa is the real OS X API. It’s here where things get really interesting, and it’s this API that blasts Mac OS X so far ahead of the competition. Cocoa is the API that Apple want software developers to use when developing all new applications for OS X – and with good reason. The core of Cocoa is Objective C, the C-derived programming language that is another part of the NeXT legacy. Alongside this is complete support for Sun’s Java 2.

Classic is the aforementioned half-API. It is in fact a Classic Mac OS emulation layer, rather like SheepShaver or Mac on Linux. When you install OS X, it must be done on top of Mac OS 9, which is provided with OS X. OS X then rather cleverly keeps a slightly trimmed version of your old System Folder. This forms the basis for Classic. If you launch a Mac application that does not support Carbon, the Classic environment boots, just like an ordinary older Mac. Classic can be run full screen or in a window.

X Appeal

Now we turn to X – the X Window system, that is. Even given what is written above, if Apple simply slapped X Windows on top of their microkernel, shrink wrapped it, and stuck on a price sticker, many people (myself among them) would be less than impressed. Instead Apple have given us Aqua, the Mac OS X windowing system.

I once saw X Windows described as a piece of useless, molten metal, and this metaphor is one I happen to agree with. Don’t get me wrong, X is infinitely configurable, but that’s not the problem – the client-server paradigm used by X is. It is nothing short of miraculous in a true client-server environment, such as thin clients and X Terminals, but it is idiotic and slow on a lone desktop. The few benefits that it does bring to the single desktop are entirely marginal. Despite this, of course, many excellent desktop environments sit on top of X, making up for its shortcomings, but why bother? I know that the X Window system has many fans, but I’m not one of them.

Apple Unix

OS X isn’t Apple’s first brush with Unix. Back in the 1990s, Apple supported the development of MkLinux, a version of Linux built on a monolithic kernel. Even farther back into the mists of time, well the 1980s, Apple developed A/UX – you guessed it, Apple Unix, a SVR4 Unix for their 680×0 series Macs.

There are, of course, non-Apple supported Unix flavours for Macs, such as M68k Linux, the various PPC Linux distributions, various BSDs, and even MacMINIX, a port of Andy Tannenbaum’s miniature educational OS which helped to give birth to Linux.

Tenon Intersystems have long produced a Unix for 68k and PPC Macs, MachTen, which runs alongside the Mac OS. This product was greatly favoured by Mac-centric ISPs. PowerPC Linux is, of course, AIX, used on the IBM RS/6000 series.

Aqua includes a new version of the Finder, the Mac OS desktop software, a bit slimmed down, a bit different, but recognisable nonetheless. The file browser owes a lot, again, to NeXTstep.The strange thing here is that most Mac users are unaware that they are using a file browser. The desktop paradigm is so complete in the Mac OS that opening windows and folders seems like an organic decision rather than a searching process. Whether this will change is yet to be seen. I feel that it is the one greatest let downs in OS X – you are actually aware that you are using a computer, whereas before you were just working.

Aqua is a joy to use. It isn’t just a windowing system and desktop environment. After using Windows or even Motif it seems like some sort of quasi-spiritual experience. Windows swoosh open. Everything is liquid and transparent.

Words are not enough to describe this. It has to be seen to be believed.

Some hard core Unix wing-nuts are no doubt dismissing this as useless frills that waste CPU cycles, but these are the people that begat us the TWM window manager, functional if it’s your only choice, but not something you’re going to fall in love with.

All of this said, if you want to use X, you can, and applications such as GIMP are good enough reason to do so. There are several open source X Window servers such as XonX and the even better, but pricey, effort from Mac Unix stalwarts Tenon Intersystems, MachTen.

Performance

Much has been said about Mac OS X’s performance, or relative lack of it, and it has to be said that on an original 233 MHz G3 iMac it does leave something to be desired. Of course, OS X is Unix, and as such it comes with a lot of bloat.

Quicksilver Power Mac G4However, the beauty of Unix is that, unlike Windows or the Classic Mac OS, the user can remove what he or she doesn’t need, and OS X stripped of some layers of techno-blubber is bound to improve in performance. It should also be remembered that OS X is still a relatively early release, and that Apple has promised to improve performance with subsequent updates. Of course, if you’re using one of Apple’s blazing dual 1 GHz G4 monsters, speed is not going to be a problem, especially as Mac OS X supports multiprocessor machines as never before.

There are some disappointments in the new operating system, however. Aqua currently supports only a single desktop, like Windows or the Classic Mac OS. This seems to go against the grain of OS development with most Unix desktops and BeOS offering multiple screens. Also lacking is journaling file-system. Although this is hardly essential, it would have been nice.

Other things to look out for are more Mac idiosyncrasies than disappointments. First of all, Apple’s single button mouse. I am a fan of this mouse – extra buttons should never have been added to the mouse, as they dilute the desktop paradigm enormously. However, for serious X Window work they’re nigh on essential. If you plan to simply stick to Aqua, though, you’re okay.

Anyone who is familiar with the Classic Mac OS at a more than cursory level will know that Mac applications are split into two separate parts, called forks. The data fork contains the actual application, while the resource fork holds information about the file and embedded resources such as PICT files and SNDs.

Many a happy day spent hacking with ResEdit are now over; forked files are dead. Instead, OS X hides the resources inside a locked folder with the extension .app. This extension is not seen in the GUI, but it is present in the terminal window. The clever bit is that the .app “folder” is actually the clickable application file. Odd, but a good way of reducing dependencies as all required files can be stored in the folder.

In these days, a 30 GB hard drive goes for under €100, so the extra space taken up by any duplication of libraries is a small price to pay for applications that run with no fuss whatsoever.

Final Words

Standard Software

Mac OS X comes with it’s own native applications, such as a screen saver, Mail, and web browsers, but it also includes many Unix favourites out of the box, such as the Apache Web server, sendmail, and, of course, a terminal.

OS X is great. OS X is beautiful. In fact, sad to say it, OS X knocks Linux into a cocked hat. This isn’t as bad as it sounds for Linux users, the new Mac OS is bound to encourage cross-fertilisation and an increase in use of any flavour of Unix is good or all other flavours.

Perhaps now isn’t the time to invest in a PPC Linux vendor, but few of these companies are pinning all of their hopes on Apple. Yellow Dog Linux runs on the new Briq servers, and SuSE have their famous x86 distribution also.

There’s more to it than this, though. As mentioned elsewhere in Linux Magazine, OS X has much higher entry requirements than PPC Linux, needing at least a G3, 128 MB of RAM, and a huge swathe of hard drive space.

PPC Linux will survive, even on the Apple platform, but as a complimentary OS rather than a direct replacement. Meanwhile, the Intel x86 is still the dominant chipset in desktop computing, and though Apple are no doubt poised to become the world’s largest Unix hardware vendor, all of the x86 machines running Unix SVR4, the various BSDs, and Linux will continue to do so.


I’ve had a lot of positive feedback about the above article, but some niggling points have been, quite rightly, brought to my attention – what Microsoft would call “undocumented features” in the article.I’ve never believed in rewriting history, so the mistakes stay, but I would like to take this opportunity to correct some details which may have proved misleading.

Firstly, Giles Hoover has pointed out that in my description of Quartz, I may have given the impression that PostScript and Portable Document Format files are interchangable – they aren’t. It wasn’t my intention to suggest they were, but it is arguable that this wasn’t clear in my writing. As Mr. Hoover rightly pointed out, PDF is a subset of PostScript.

Secondly, as Jimmy Champlain and Greg Meece pointed out, I stated that Classic can be run full screen or in a window. Again, sloppy writing on my part – this is not quite what I meant and stems from the fact that I was writing for a Linux audience and needed a way to describe Classic. I decided that I’d come back and fix it later. I forgot to do so. There’s a lesson here.

Now, onto a genuine error. MKLinux is, of course, based on a microkernel, which is why it is unusual for a Linux distro.

I’ll award myself an F grade for those mistakes. I’m very sorry about it and hope that it didn’t spoil your enjoyment of the article, which hopefully taken as a whole is still as informative as it was meant to be.

Thanks to everyone who emailed to point out the errors.

Yours,
Jason Walsh

Keywords: #macosx #linux #ppclinux

Short link: http://goo.gl/f3OEaa

searchword: osxfromalinuxview