Mac OS X vs Linux on the iPhone and Mobile Devices
 
Windows Mobile, Palm OS, Linux, and Symbian currently power the world’s smartphones. How does each stack up against Apple’s OS X in the iPhone? This article presents an overview of Linux. 
 
The use of Linux for mobile devices is similar to Apple's approach in using a version of its desktop Mac OS X on the iPhone. Other mobile operating systems--from the Palm OS, to Microsoft's WinCE, to Symbian--originated out of a software platform designed for PDAs, and was adapted for use in phones afterward.
 
 
Neither OS X nor Linux was designed expressly for mobile use either; both are designed to provide general purpose computing environments.
 
That means that while neither may be the best choice to power a simple phone, both offer advantages when moving past the phone and into the realm of an Internet device and media player. Here's a look at how the history of both intermingle.
 
Pre-Linux GNU: 1983-1990
The portion of Linux that most users interact with isn't actually Linux at all, but rather the userland of GNU. In 1983, Richard Stallman created the GNU Project to create an entirely free computing environment that would be compatible with commercial Unix without any expensive licensing required from AT&T.
 
Throughout the rest of the 80s, GNU worked to complete set of Unix-style userland packages and programs:
 
  1. the GCC, the GNU Compiler Collection
  2. the GNU C library
  3. the GNU Binaries Utilities
  4. the GNU Core Utilites
  5. the bash command line shell
  6. the GNU Emacs text editor
 
GNU HURD and Microkernels: 1990-1996
By 1990, the userland portion of GNU was mostly complete, and the group turned its attention toward building a kernel. The idea of replacing existing "monolithic" operating system kernels with a microkernel design was in high fashion in the late 80s and early 90s.
 
GNU planned to build a microkernel and set of external servers called the GNU HURD, which intended to replace the conventional Unix kernel with more advanced technology.
 
Conceptually, the idea was simple: rather than having one large chunk of code managing everything at a low level, the microkernel design planned to create a tiny, very secure microkernel that would interact only with the hardware below and exchange messages with the external servers above it.
 
Microkernel systems were supposed to be simpler, easier to port to new processors, easier to optimize for high performance, and held out the tantalizing potential of being able to support multiple operating system personalities at once.
 
CMU had been getting a lot of attention for Mach, its experiment to retrofit the traditional BSD Unix kernel with a microkernel design. In its second version, Mach wasn't yet a true microkernel, but rather a hybrid design that incorporated new, multithreading kernel ideas but did not yet push all of the BSD code out into external server components. That was planned for Mach 3.
 
NeXT began work on its own operating system using Mach 2.5, and was joined by the OSF, Apple, IBM, and GNU. Apart from NeXT, other groups were trying to get Mach 3 to work as a full microkernel. They ran into many of the same problems; as it turned out, the microkernel design was not well suited to general purpose computing.
 
Microsoft jumped on the microkernel bandwagon in the mid 90s with Windows NT, just as the rest of the industry was realizing that microkernel designs weren't going to work. Microsoft discovered similar problems in NT 3.x, and made major changes to stuff components back inside the kernel to improve performance, at the cost of stability and security, in NT 4.0.
 
The Linux Kernel: 1991-1996
In 1991, Linus Torvalds began work on Linux as an entirely new kernel, just prior to AT&T's lawsuit against BSDi. That lawsuit left BSD Unix, the only complete and free Unix alternative, with a questionable future. By the time the lawsuit was resolved, Linux had established itself as a third major alternative to AT&T and BSD Unix.
 
The Linux kernel followed the design of existing monolithic kernels, essentially reinventing the BSD wheel, but doing so with volunteer talent and starting from scratch.  
 
Since the GNU's HURD microkernel failed to materialize, the userland software completed by the GNU Project was paired with the Linux kernel to provide a full, free environment to replace commercial Unix. Together, this combination is sometimes referred to as GNU/Linux, but is commonly just called Linux.
 
Since Linux is offered under the same GPL license as the GNU software, any part of Linux can be freely optimized to fit customized needs. Linux is also free to distribute, as long as the source code and any improvements are made available as well.
 
A number of companies have created their own distribution of Linux, some to fit specialized needs, others simply to profit from reselling a product that is already free to obtain.
 
Apple created its own Linux distro with the OSF in early 1996 called mkLinux. It ran Linux on top of the Mach 3.0 microkernel, and was designed primarily to interest Linux users in Mac hardware.
 
After Apple bought NeXT at the end of that year, Apple’s interest in maintaining either Mach 3.0 or Linux waned as it focused its new developments on NeXT's Mach/BSD hybrid kernel. That product was released as the Darwin open source project, and also forms the core of Mac OS X.
 
Linux vs. Darwin at Apple: 1997-2007
In 1997, the world was as abuzz about Linux as it had been about Mach in 1992. Talking about Mach had fallen out of fashion after Mach 3.0 developments had run into disappointing snags across the industry.
 
Columnists and analysts with only a tenuous grasp of buzzwords decided that the simple solution to Apple's engineering efforts was to yank out Mach and start using Linux like everyone else.
 
What they apparently didn't realize is that engineers at Apple a lot of familiarity with both Linux and NeXT's Mach/BSD hybrid kernel. Both were in concurrent development at Apple, along with a long history of Unix development that also involved Apple’s A/UX, IBM’s AIX, and kernel development related to Copland and other experimental projects that were never released.
 
There are a number of reasons Apple engineers didn't stuff Linux underneath Mac OS X. First, BSD simply has advantages over Linux. As stated in the Mac OS X Linux Kernel Myth:
 
"Linux is designed to be good enough to get the job done when the job could be most anything. Linus Torvalds doesn't claim that Linux is a perfect architecture and avoids comparisons about having the best design. Linux code quality is not unquestioned."
 
Further, while freedom to tweak on an open code base like Linux is a huge advantage to a company that just wants to repurpose it to run a DVR or build a router, Apple is better suited developing its own code because it allows the company to make significant changes as it sees fit:
 
"Apple doesn't have to design its kernel to fit a variety of needs, so it can lay out perfectionist plans to build an ideal architecture to suit Mac OS X. This allows it the luxury of chucking out clunky old ideas and starting fresh with clean modern ones, something that general purpose projects with lots of external dependencies and entrenched ways of doing things can't do. One obvious example of this is launchd."
 
Apple does far more custom kernel development than most companies selling Linux. Further, any changes to the Linux kernel can only be made by committee decision. For Apple to make any significant changes on its own, it would have to fork the Linux kernel, losing any benefit to being on Linux in the first place.
 
"Apple also has to carefully control what changes are made below the API so that outside developers working on top have a consistent and stable platform to work on. This would be far more difficult if Apple were not in sole control of what was going on underneath. Apple can't adopt Linux for this reason alone."
 
The more details one examines, the more obvious it is why Apple isn't using Linux. Since 2000, Apple has rapidly deployed new versions of Mac OS X and ported it from PowerPC to Intel processors, selling more than 26 million Unix-powered Macs.
 
Apple would have been repeatedly constrained in delivering the same pace of development were it working on code managed by an outside group.
 
Shared Software between Linux and OS X
Under the application layer, the actual differences between Linux and OS X applies mainly to the core kernel design of each.
 
Apple's kernel derives from NeXT; the Mach/BSD hybrid design has been updated by Apple, incorporating modern developments related to both Mach and BSD.
 
Mac OS X's userland comes from all over; it uses a large amount of GNU software, including the GCC compiler. In Tiger, Apple adopted the typical Linux bash command line shell instead of the previous default of tsch.
 
Linux users have little to learn when working on Mac OS X, apart from some minor differences in where files are located. Linux server software is typically trivial to port to Mac OS X, and a great deal of software from both Apple and third parties is powered by open source code.
 
The biggest difference between Linux and OS X in mobile development is that OS X is only available to Apple. For open source advocates, this raises issues about freedom of control, access to code, and the development potential available to third parties.
 
The next article looks at how those and other issues relate to both Linux and OS X.
 
Next Articles:
 
 
This Series
 
What do you think? I really like to hear from readers. Leave a comment or email me with your ideas.
 
 
| | Del.icio.us | Technorati | About RDM : :

Send Link | Reddit | NewsTrust |

Download the RoughlyDrafted iMix Jan 2007 | Feb 2007

 

Apple StoreApple Store

Apple iTunes

Apple iTunes

Apple iTunes

Friday, February 2, 2007
| | Del.icio.us | Technorati | About RDM : :