According to Hoyle...
Mac OS X
10.6 Snow Leopard Preview
August 2008
by Jonathan Hoyle
jonhoyle@mac.com
http://www.jonhoyle.com
Last month, we reviewed
this year's Worldwide Developer Conference,
the all-important Apple conference for programmers, engineers and and other technically inclined
Mac
person. Although much of the media blitz was over the new
iPhone,
most conference attendees found the information about the new upcoming
Mac OS X 10.6 Snow Leopard
release to be of greater importance.
Confidentially Yours
Much of what was
discussed at WWDC is covered under
Apple's
Non-Disclosure Agreement. Now,
admittedly, it doesn't take a great deal to get into the
"secret circle"... essentially, you must simply sign up for a free
Apple Developer Connection
membership, electronically check the confidentiality clause, and boom, all
of Apple's free online information is there for your perusal. However, since
this article is outside this arena, I will be covering only those areas which are
available to the general public, and I'll make suggestions as to where to look for
those who do have ADC memberships and wish to investigate further.
What is not
hidden behind the shroud of Apple secrecy? One thing which is you can usually
count on is that
the Steve Jobs keynote address
is freely accessible, as Steve likes to use this pulpit to preach to the unconverted. Unfortunately,
this year's sermon did not cover the Macintosh at all, but rather was more iPhone-specific. This
is very annoying to be sure, but fortunately, Apple has released a lot of public
information about Snow Leopard through other avenues, such as press releases,
web pages and information posted about WWDC itself.
For a high level
overview on what Mac OS X 10.6 Snow Leopard has to offer, visit
Apple's web page about it.
Intel Inside
One of the
biggest rumors spreading about was that Snow Leopard would be
Intel-only. This
is hardly much of a surprise, given that Apple had
announced its Intel products
over three years ago, and stopped selling
PowerPC-based Macs
as of two years ago. Many developers had been expecting this move for some
time now, so it would have been more surprising had it not happened. Just
days before WWDC, however,
Gizmodo
had predicted just the opposite:
that PowerPC was going to be a supported platform on Snow Leopard. Unfortunately,
Gizmodo's reasoning was faulty: it assumed that the existence of PowerPC-based drivers
in the OS implied that the OS would target PPC. An Intel-only version of
Mac OS X would still require PowerPC-based drivers simply because
Rosetta
emulates applications that will need them. I predict that Rosetta will
be around for at least until
10.7 or
10.8,
so we should expect to see PowerPC-built drivers (at least the
32-bit
versions) around for a while.
As you are
probably already aware by now, the original prediction was correct: Snow Leopard
is indeed Intel-only. Although I cannot find any Apple-authorized statement to
this affect, I see that Snow Leopard's actual system requirements have already
been released (leaked?) through dozens of web sites, including
MacUser,
Ars Technica,
MacNN,
Softpedia,
Apple Gazette,
OS News,
The Unofficial Apple Weblog,
and many, many others. I can only assume that Apple verbally confirmed this
to the various news outlets, as I do not find any publicly released statement to that
affect on Apple's web site (at least at this time). In any case, the cat is out
of the bag (so to speak), and so I guess there is no harm in confirming that this
is indeed true, as I can attest: having a
Snow Leopard Prerelease DVD
of my own.
A Thinner Fat
Of course,
what this means is that for those compiling applications to run on Snow Leopard
only, you need to compile only for two way Fat:
Intel 32-bit and
Intel-64-bit. Indeed,
one could change that and to an or and make
it one-way Fat: as most Intels out there today already support 64-bit. For
DLL and
plugin developers, you will want to compile your programs as three-way
Fat: Intel-32, Intel-64 and PowerPC-32. Why is that? Well, simply a DLL
or plugin must match the
architecture of the host application which loads it, and these are
the only three types of applications that will run on Snow Leopard. (Recall
that the PowerPC emulation provided by Rosetta is 32-bit only). Even
for those wishing to support both
10.5 Leopard
and 10.6 Snow Leopard in their builds, there is a very strong argument for dropping
PowerPC 64-bit
support: namely that PPC-64 lived and died in 10.5 Leopard, and only the highest end
G5 machines would even be able to run such applications. Furthermore,
some of the technological advances in compiler options do not even bother to support
PPC-64 (see below). Those developing in
Java have
already seen this limitation: 64-bit Java has always been Intel only.
Xcode Marks the Spot
Whether Apple
actually intended to publicly release information about
Xcode 3.1
I do not know, but publicly released it, they did. On the non-member
version of their WWDC web site (which is indeed public), they give the following
description about Session #907:
New Compiler Technology and Future Directions:
Xcode 3.1
introduces two new compilers for Mac OS X: GCC 4.2 and LLVM-GCC. Learn how the new
security and performance improvements in GCC 4.2 can help you produce better applications. Understand
the innovations in LLVM-GCC, and find out how you can use it in your own testing
and development. Finally, get a preview of future compiler developments.
This, of course,
announces a couple of things: that the next version of
Xcode
is called 3.1, it will be able to use
gcc 4.2
(a vastly improved version of gcc, which has remained stagnant at
4.0.1
for about three years now), and Xcode 3.1 will be able to opt for the newest
and most powerful technology: LLVM. Since both
gcc and
LLVM are
open source projects,
you can see what these new compilers have to offer without having to limbo under
Apple's NDA pole. I will go into further detail on these compilers in a
future article, but for now, I can assure you that this is great news for Mac developers.
For those who
have not already done so, it's simply time to say goodbye to the old
gcc 3.3
world. gcc 4.2 is binary compatible with
gcc 4.0,
so you will be able to mix and match code with these. But gcc 3.3 is
dead (and should have been made so long before now).
Sadly, I do not
see many article written by other about the new Xcode yet, despite the fact
that so much about it is already public domain information.
When is an Upgrade not an Upgrade?
One of the announcements
about Snow Leopard which has caused a great deal of confusion has to do with
its feature set; or better stated: its lack thereof. Without the whiz-bang
features found in the previous releases of Mac OS X, many people are mistakenly
viewing 10.6 as merely a bug fix release, more aptly named 10.5.5. This is far
from the truth. Although there are virtually no new user-level features,
the infrastructural changes abound, making this release all worthwhile. You
may recall that
the 10.1 release of Mac OS X
was essentially the same way. And frankly, it's high time that Apple had another
infrastructural release of its operating system. With all of the new widgets
and features added to
10.4 Tiger,
followed by the dump truck pouring of features in 10.5 Leopard, performance
tuning and framework updates are a welcome substitute to yet more new features. With
the dropping of the PowerPC platform, Apple has a great opportunity now to truly
concentrate on these kinds of improvements. Will it be worth the $129 they'll
likely be asking for it? You're damn right it will.
Apple Cores
One essential
and powerful new addition to Snow Leopard is the ease with which developers
can finally take advantage of all those extra cores in the computer. Until now,
it was exceedingly difficult for a developer to write
multithreaded code. The
overhead and headaches involved with
pthread's and
mutexes
can be enormous (as I know, having to deal with them day to day). How many
cores are on the machine? How many are actually available? I might take
a great deal of time to implement a threaded design to improve performance on one
machine, only to find that it hinders performance on another. Yuck. This
is why so many programs today are still single-threaded and waste all of that extra
processing power your Mac has to offer.
With Snow
Leopard, all of that changes. Now it becomes very easy for the developer
to write his code in such a way that it will dynamically take advantage of extra cores
(if they exist) and to skip it otherwise. In this day where processor speeds
are beginning to plateau, but processor and core numbers are increasing, this is
the best path forward for application design.
In this area,
there are several technologies available to the Mac developer to choose from. The
Cocoa
developer will like using
Grand Central Dispatch, an
Objective-C based
approach which will make multithreaded development a breeze. This is a great
improvement over the creaky
NSOperation class
formerly available. For graphics and mathematical developers, the new
OpenCL API
takes great advantage of the hardware's power and speed, particularly for the
GPU. The
C++
developer will likely find gcc 4.2's
OpenMP
protocol (a
cross-platform
API) to be just what the doctor ordered. And unlike the other
options I just mentioned, this one is open source, and so is publicly available
now. I gave a brief code example of OpenMP's use in
an article last year.
Carbon Dating Yourself
For those who
have not gotten the message yet, a look at this past WWDC schedule would see one
Carbon
session, only two labs (and both of these as transitions to Cocoa). I too am
finding it a bit painful to kick the Carbon habit, as it has been my fluency back to the
original Mac Toolbox
days of the mid 1980's. Unfortunately,
Steve Jobs
has spoken, and he has dealt a death blow to Carbon. We may mourn, but we
also must move on.
The Cocoa
framework itself seems interesting enough, but it's simply getting past that damn
fugly Objective-C syntax which is the hard part. When your eyes wince at reading
such code, it is not a very attractive proposition. Luckily, you have
Uncle Jonathan
here willing to take one for the team for
you. Next month, I will spend an entire column devoted
to C/C++ programmers and how to minimize the pain of Objective-C and exactly what
all those damn brackets really mean.
Watch Your Language
If after all
the brainwashing and Kool Aid you still don't like Objective-C, fear not. With
the latest versions of Xcode, you will be able to develop first class applications
using alternative languages such as
Ruby,
Python, and even
AppleScript. Start with
Interface Builder
to create your
GUI,
but simply use your language of choice for coding. Although Objective-C remains
the favorite son (getting all the cool new features first), there is no reason you
should ignore these language alternatives, if they suit your needs. I will spend
time in a future article on this particular feature.
A Kernel of Truth
At
WWD 2007,
Steve Jobs claimed that Mac OS X 10.5 Leopard was 64-Bit
"Top to Bottom". Well, sadly, this was simply untrue. Despite the
claims, the OS kernel in Leopard remained 32-bit. However, as of Snow Leopard,
the 64-bit kernel will arrive and save Steve from his departures from reality. For
most developers, this change will be transparent, as 32- and 64-bit apps will continue
to run side-by-side. However, those writing kernel extensions will have to
change their compiler options from two-way Fat to three-way Fat. (No Mac kernel
was ever PPC-64, so this particular architecture can be ignored). More on this
also in a future column.
Coming Up Next Month: Too embarrassed to ask what all
that Objective-C grunge means? Don't Panic, I will hold your hand through to
get you to understand
what Objective C is all about. See you in 30!
To see a list of all the According to Hoyle columns, visit: http://www.jonhoyle.com/maccompanion
http://www.maccompanion.com/macc/archives/August2008/Columns/AccordingtoHoyle36.htm