Hypercritical


Avoiding Copland 2010

Classic Mac OS, as it’s now known, had a decade-long honeymoon period. From its release in 1984 until 1994, it enjoyed a healthy development life that included several major revisions. But by 1994, the limitations of the OS were apparent to technophiles both inside and outside Apple. Sure, there was a lot of legacy cruft from the 80s in what was then known as System 7, but the real problems were more fundamental. These problems were so well-known that I’m sure anyone who was a “PC enthusiast” back in those days can rattle them off. Classic Mac OS lacked two very important features. Say it with me, folks:

Memory protection and preemptive multitasking

In the early 1990s, Apple created the Copland project to add these two features to its operating system. Yes, a lot of new end-user features were going to be added as well, but memory protection and preemptive multitasking were Copland’s raison d'être.

Funny story—as it turns out, it wasn’t too easy to add these features to classic Mac OS while also maintaining backward compatibility with existing software. Oh, and did I mention that Apple switched processor architectures around this time as well? By 1996, the Copland project was dead, and classic Mac OS still lacked memory protection and preemptive multitasking.

Thus began a downward spiral that included several more frantic, abortive attempts to solve Apple’s OS dilemma. We all know how it ended. A series of unlikely events led to the return of Steve Jobs and the refashioning of NeXTSTEP into Apple’s new operating system—yes, an operating system with memory protection and preemptive multitasking. Phew.

So, here we are in 2005, with several major revisions of Mac OS X behind us. Maybe we Mac users are feeling a bit smug, knowing that we once again have The Best Operating System™. Of course, I felt that way in 1991 when System 7 was released, too. But a mere five years later, things were going downhill fast. Hm.

Will Mac OS X suffer the same fate? Surely not, you say. Mac OS X is The World’s Most Advanced Operating System! But this is exactly the kind of thinking that lets an OS crisis sneak up on you. It’s worthwhile to think about what Mac OS X will need in order to remain competitive two, five, even ten years in the future.

Obviously Mac OS X will need (and will get) a ton of new features in the coming decade or so. The trick is to find the equivalent of “memory protection and preemptive multitasking.” That is, the features that will be essential in the future, but that are very hard to add while still supporting existing software.

I’m tempted to make this a two-part post, asking the readers to write their opinions in the comments area first, and then revealing mine in a follow-up post. But that’d be cruel (or lame, take your pick), and I’m sure plenty of people would have the same ideas I do. Why let them steal my thunder?

So, here it is. Here’s what I think will quickly become Mac OS X’s most glaring technical limitation, and what could lead to another Copland-style disaster if Apple isn’t careful. Here’s what Mac OS X is missing today that will be very difficult to add later without causing big problems for existing software and developers:

A memory-managed language and API

<cue dramatic music>

Both of Mac OS X’s primary application development APIs require the programmer to manually manage memory. Carbon is a C-based API, and memory management doesn’t get much more manual than plain-old C these days. Cocoa uses Objective-C, which abstracts memory management with a retain/release system, but the programmer must still explicitly trigger or schedule these actions. Under the covers, Objective-C is just a runtime engine on top of C anyway, so it’s no surprise that manual memory management is still part of the development experience.

But why is this a bad thing? Doesn’t manual memory management offer more opportunities for optimization? Aren’t languages with totally automatic memory management “slower” than their lower-level brethren? Yes and yes. But “more abstracted” is a better way to think of those “slower” languages, and “more abstracted” always wins in the end, especially when it comes to operating systems and application development.

I don’t want to go down the rat-hole of programming language religion, but suffice it to say that languages (and their associated APIs) that support automatic memory management are the future of software development. In fact, in many cases, they’re the present. Java has made great strides in the server arena, and languages like Perl, Python, and Ruby are coming from the other direction. C, C++, and yes, even Objective-C, are being squeezed in the middle.

As was the case with the memory protection and preemptive multitasking crisis, Microsoft is way out ahead on the memory-managed language/API front. MS has its own new programming language, C#, and is working on an all-new memory-managed API to supplant the venerable C-based Win32 API. These are both projects that were started years ago, and that are finally coming to fruition today.

Whither Apple? Back when C# and the API that would come to be known as WinFX were on the drawing board at Microsoft, Apple was kind of busy trying to finally get over that pesky “memory protection and preemptive multitasking” thing. Today, Carbon and Cocoa are just settling down; Tiger is the first Mac OS X release to be accompanied by a promise from Apple that APIs won’t be intentionally broken in future releases.

Put bluntly, Apple is way behind here. Yes, “Copland” behind.

Even if Apple is smart and “borrows” an existing memory-managed programming language (hello, C#), there’s still that pesky API issue. Apple recently killed their Objective-C/Java bridge, and with good reason. Bridges stink. So forget about an Objective-C/C# bridge. And no, don’t talk to me about adding garbage collection to Objective-C. That is exactly the sort of “half-way” mindset that led to Copland. No, Apple needs to pull a WinFX and rethink the whole widget, so to speak, from top to bottom.

New APIs are extremely risky and hard to pull off, of course. Plus, Apple’s just coming off a big transition, moving from the Mac Toolbox to Carbon and, for new development, to Cocoa. It’s way too soon to even think about another move, right? Sure, if you’re a developer. But if you’re Apple, you’d damn-well better be thinking about it—not only thinking about it, but beginning work.

Oh yeah, that’s right, there’s some other transition going on right now, isn’t there? Well, fine, delay the whole memory-managed language/API thing a year or two if necessary. But someone, somewhere at Apple had better be thinking long and hard about this issue. If Apple does get itself into another Copland-style jam around 2010, I’m not sure there’ll be any pre-fab “modern operating systems” hanging around for them to purchase and refurbish this time.


This article originally appeared at Ars Technica. It is reproduced here with permission.