Motherboards Memory Storage Cases/Cooling/PSUs IT Computing Displays Mobile Mac CPUs & Chipsets Video Digital Cameras Linux Gadgets Systems Trade Shows Guides Home Increase Font Size Decrease Font Size Change Page Size
No more mysteries: Apple's G5 versus x86, Mac OS X versus Linux
No more mysteries: Apple's G5 versus x86, Mac OS X versus Linux
Date: June 3rd, 2005
Topic: Mac
Manufacturer: Various
Author: Johan De Gelas
Buy the For Dummies 764576755 dummies Mac OS X
Blank
 Amazon $14.95
 Buy.com $13.38
 
 

Mac OS X: beautiful but...

The Mac OS X (Server) operating system can't be described easily. Apple:

"Mac OS X Server starts with Darwin, the same open source foundation used in Mac OS X, Apple's operating system for desktop and mobile computers. Darwin is built around the Mach 3.0 microkernel, which provides features critical to server operations, such as fine-grained multi-threading, symmetric multiprocessing (SMP), protected memory, a unified buffer cache (UBC), 64-bit kernel services and system notifications. Darwin also includes the latest innovations from the open source BSD community, particularly the FreeBSD development community."

While there are many very good ideas in Mac OS X, it reminds me a lot of fusion cooking, where you make a hotch-potch of very different ingredients. Let me explain.


Hexley the platypus, the Darwin mascot

Darwin is indeed the open Source project around the Mach kernel 3.0. This operating system is based around the idea of a microkernel, a kernel that only contains the essence of the operating system, such as protected memory, fine-grained multithreading and symmetric multiprocessing support. This in contrast to "monolithic" operating systems, which have all of the code in a single large kernel.

Everything else is located in smaller programs, servers, which communicate with each other via ports and an IPC (Inter Process Communication) system. Explaining this in detail is beyond the scope of this article (read more here). But in a nutshell, a Mach microkernel should be more elegant, easier to debug and better at keeping different processes from writing in eachother's protected memory areas than our typical "monolithic" operating systems such as Linux and Windows NT/XP/2000. The Mach microkernel was believed to be the future of all operating systems.

However, you must know that applications (in the userspace) need, of course, access to the services of the kernel. In Unix, this is done with a Syscall, and it results in two context switches (the CPU has to swap out one process for another): from the application to the kernel and back.

The relatively complicated memory management (especially if the server process runs in user mode instead of kernel) and IPC messaging makes a call to the Mach kernel a lot slower, up to 6 times slower than the monolithic ones!

It also must be remarked that, for example, Linux is not completely a monolithic OS. You can choose whether you like to incorporate a driver in the kernel (faster, but more complex) or in userspace (slower, but the kernel remains slimmer).

Now, while Mac OS X is based on Mach 3, it is still a monolithic OS. The Mach microkernel is fused into a traditional FreeBSD "system call" interface. In fact, Darwin is a complete FreeBSD 4.4 alike UNIX and thus monolithic kernel, derived from the original 4.4BSD-Lite2 Open Source distribution.

The current Mac OS X has evolved a bit and consists of a FreeBSD 5.0 kernel (with a Mach 3 multithreaded microkernel inside) with a proprietary, but superb graphical user interface (GUI) called Aqua.

Performance problems

As the mach kernel is hidden away deep in the FreeBSD kernel, Mach (kernel) threads are only available for kernel level programs, not applications such as MySQL. Applications can make use of a POSIX thread (a " pthread"), a wrapper around a Mach thread.


Mac OS X thread layering hierarchy (Courtesy: Apple)

This means that applications use slower user-level threads like in FreeBSD and not fast kernel threads like in Linux. It seems that FreeBSD 5.x has somewhat solved the performance problems that were typical for user-level threads, but we are not sure if Mac OS X has been able to take advantage of this.

In order to maintain binary compatibility, Apple might not have been able to implement some of the performance improvements found in the newer BSD kernels.

Another problem is the way threads could/can get access to the kernel. In the early versions of Mac OS X, only one thread could lock onto the kernel at once. This doesn't mean only one thread can run, but that only one thread could access the kernel at a given time. So, a rendering calculation (no kernel interaction) together with a network access (kernel access) could run well. But many threads demanding access to the memory or network subsystem would result in one thread getting access, and all others waiting.

This "kernel locked bottleneck" situation has improved in Tiger, but kernel locking is still very coarse. So, while there is a very fine grained multi-threading system (The Mach kernel) inside that monolithic kernel, it is not available to the outside world.

So, is Mac OS X the real reason why MySQL and Apache run so slow on the Mac Platform? Let us find out... with benchmarks, of course!

Mac OS X versus Linux   Next Page

 
  Index

Tools Share
Find lowest prices Find the lowest prices
Digg   del.icio.us   E-mail  
Print This Article Print this article  

112 Comments - Last by edchi, 959 days ago
Username:
Password:
No Subject by Methodical, 1712 days ago
I like anands articles way better.

Your drawing too many conclusions off of data you basically call untrustworthy, but I agree your basic conclusion. The OS still needs more work.

I really think leaving out After Effects was a bad idea. Its a perfect benchmark. Plugins that do the exact same calculations on the exact same workfiles. Its also one of the biggest things these macs are used for, but I understand your article to be a bit more server-oriented.

Reply
No Subject by ailleur2, 1712 days ago
Well that was interesting.

Im a big apple fan myself but even i never thought od putting osx server in a server room.
I think the g5 did quite well and had IBM delivered its promise of a 3ghz g5 (and that was supposed to be a year ago) the g5 would have won a couple of tests by a good margin.

If apple/IBM want altivec optimisations, i think theyll have to do it themselves since the interest level is pretty low.

One question though, why wasnt linux installed of the g5 if this was a cpu test? I dont know if it makes a damn of a difference but it whould have put them on equal bases.

Reply
No Subject by ailleur2, 1712 days ago
Oh and the graph on page 5 doesnt display correctly in firefox.

Reply
No Subject by wessonality, 1712 days ago
No Subject by wessonality, 1712 days ago
What about installing Yellow Dog Linux on the XServe?

Reply
No Subject by porkster, 1712 days ago
"Root Me" in Australian slang is the same as "Fxxk Me" in common language. Some people my find a picture in this review offensive.

Reply
No Subject by StuckMojo, 1712 days ago
yes, it seems you've left out a very good method of testing if OSX is the issue: run a powerPC linux distro with the mysql and apache benchmarks and see what happens!

i'd be _really_ interested in the results. see if you can update the article with them.

Reply
No Subject by StuckMojo, 1712 days ago

hmph. you say it yourself in the last paragraph...how come you didn't try it?

Reply
No Subject by JohanAnandtech, 1712 days ago
Porkster: It is a little geekisch Unix joke. Where is your geekish you man spirit?

Wessonality: Our next project if we can keep the G5 long enough in the labs.

Ailleur2: indeed, I agree. The G5 is a potent CPU with a lot of potential. Just give it a bigger L2 and a better memory subsystem. This is an architecture that could last very long by applying a few tweaks, like the P6.

Methodical: All of the benchmarks are trustworthy, they should be looked upon as a whole to get a good picture, not just pick one. About After affects, I indicate that the G5 does very well here (seen other reports on the web), I just didn't have the software in the lab.

I also warned that this was not about "should I buy an Apple or not?". It is just "if performance is what counts for me, where should I position the G5/Mac os X combiantion compared to x86/Linux/Windows ?".



Reply
No Subject by IntelUser2000, 1712 days ago
People, in case some of you misunderstand, the 10.8GB/sec Full Duplex bus means that its two 32-bit 1350MHz bus, rather than one 64-bit bus in the PCs. Its not, 10.8GB/sec x 2 =21.6GB/sec bus, its 10.8GB/sec bus(or more correctly stated 5.4GB/sec x 2). Plus, it says in Apple site that it has TWO(yes two!!!) of the 10.8GB/sec buses, per CPU.

Summary: Per CPU=10.8GB/sec
Per Dual Processor System=21.6GB/sec


Johan, about the AMD TDP number, they never state that its max power, they say its maximum power achievable under most circumstances, its not absolute max power.

Reply
Comments Page 1 of 12

Unlicensed Software at Your Last Company
Anonymously Report Unlicensed Software with Our Form Now. Get Up to $1 Million.
Special Offer from The Economist
Get 12 issues of The Economist for $12. US subscribers only.
Free Forrester Risk Management Report
Demystifying Enterprise Risk Management. Download Free With Registration.
DOWNLOAD vWire Today - FREE TRIAL
Take Control of Your Virtual Infrastructure. Manage VI Data & Prevent Problems.
Download Microsoft Visual Studio ® Team System
Streamline Dev processes, Reduce time to market. Try Microsoft Visual Studio Team System, FREE!




Latest news by
DailyTech

 February 9, 2010

Blank
Blank
Blank
Blank
Blank
Blank
Blank
Blank
Blank
Blank
Blank
Blank
Blank
Blank
Blank
Blank

 February 8, 2010

Blank




pipeboost
Copyright © 1997-2010 AnandTech, Inc. All rights reserved. Terms, Conditions and Privacy Information.
Click Here for Advertising Information