Apple's OS X: How Does it Fit on the iPhone?
 
How can Apple squeeze Mac OS X into the iPhone? On a Mac, a minimal installation of OS X takes up at least 10 GB of disk space, and happily consumes all the RAM it can find. The iPhone doesn't have a hard drive at all.
 
Here’s a look at the system, how its parts add up, and how it can fit into a reduced environment.
 
Where Stuff is in Mac OS X
Components of Mac OS X break down into three main buckets, referred to as domains.
 
  1. System domain, in /System, includes the software Apple provides as the core parts of the operating system: the Finder, background services, Carbon and Cocoa libraries.

  2. User domain, found inside /Users, is a place for software and settings pertaining to a specific user account.

  3. Local domain includes most everything else: most applications users see, along with third party tools, frameworks, settings, and support files.
 
Some users in networked business settings may also use a Network domain, which includes shared assets and applications on a remote server. Additionally, there is the BSD Unix userland and Mach kernel, which is all normally invisible from the Finder.
 
How Big is Mac OS X?
On a typical Mac, files in the User domain--including movies, songs, photo libraries, and documents--commonly make up the majority of the disk space used. The same is true for the iPod: its gigabytes of disk space are intended for the user's own stuff, not the minimal core OS and micro applications that run the device.
 
After that, the next largest chunk is in Applications. For a typical Mac user, the Applications folder and easily be 25 GB or more. Individual applications can appear to be huge. For example, Pages and Keynote in iWork 06 are both around a gigabyte each!
 
This is somewhat deceptive however; the actual code in these applications is dwarfed by large amounts of template graphics hidden in the application bundle. Over 90% of those applications' bulk consists of graphics, foreign language localizations, help files, and other resources apart from the actual code.
 
Diet Code
The entire System directory in Mac OS X typically consumes less disk space than iWork, but even the system software is full of graphics and other resources, as well as lots of desktop code inessential to the iPhone.
 
For example, of the half gigabyte of disk space taken by Mac OS X frameworks, nearly a quarter is consumed by support for Sun's Java Virtual Machine. Ditching that lowest common denominator platform on the iPhone is an easy call; most of it is entirely duplicative of Apple's own Cocoa frameworks anyway.
 
In Macworld: Scorecard and Secrets of the iPhone I attempted to give other examples of code that wouldn't be necessary on the iPhone. It turns out the examples I cited were pretty terrible.
 
It suggested the iPhone would have little use for fancy typography such as ligatures, but readers pointed out that ligatures--while mostly ornamental in English--are essential in many foreign languages. Including OS X's sophisticated typography support would greatly differentiate the iPhone in foreign markets; I can't imagine anyone doing Korean typography in Flash Lite, for instance.
 
I also cited no need for printing support or for overlapping windows. While those specific features might not appear in the same form on the iPhone, the actual functionality driving them in Mac OS X is the Quartz drawing engine. Along with Core Animation, it would need to be available in order to draw the iPhone's Dashboard-like windows and render everything else on the screen.
 
After giving additional thought to the actual size of code, it's clear I was shooting down the wrong alley. The entire Apple Type Services and Quartz drawing frameworks consume considerably less than 100 MB, even before making any effort to trim things down.
 
The iPhone doesn't really need to drop a lot of the functionality of Mac OS X code, but rather just the fat resources liberally used in a desktop environment, where there is little regard for the minimal price of disk space they consume.
 
Cutting the Fat
A typical Mac OS X installation contains 2,000 MB of printer support files. GarageBand installs 3,000 MB of instruments and loops, and iDVD drops nearly another 2,000 MB in template files. Fonts consume hundreds of megabytes, and many apps--including Microsoft Office and Adobe Creative Suite--hide away their own copies of the same fonts for safekeeping.
 
In comparison, the Mach kernel is less than 4.6 MB, and the rest of the invisible Unix userland and all its support files fit within 1 GB. That includes a full Apache web server, SAMBA support for Windows file sharing, an entire X Window graphical environment, full development tools, and all of the log files and junk accumulated over the last couple years by the particular installation of Tiger I happen to be poking on here.
 
The iPhone won't need a web application server. With some cleanup, including the removal of other unnecessary services, graphics, and other optimizations, it becomes easier to see how a subset of Mac OS X can squeeze into the iPhone.
 
Memories...
How much will Mac OS X need to squeeze? Unfortunately, Apple is being excessively vague about the iPhone's exact specifications. It only cites 4 or 8 GBs of memory, but doesn't actually state that this is just its Flash capacity. It most certainly is; the iPhone would also need additional RAM and ROM to actually run.
 
  1. System RAM is, like a PC's RAM, ultra fast working memory that applications need to run. When the power goes out, its contents are lost. It’s also known as DRAM or SDRAM.

  2. Flash RAM is slower storage RAM. Applications running from Flash RAM would be very slow; it's used for storage, like a very fast hard drive. Its contents survive a power outage. Also called NVRAM.

  3. ROM is firmware memory, used for storage on boot. It doesn't need power, but it can't typically be rewritten. Today, a ROM image is commonly stored in Flash RAM.
 
The 80 GB iPod secretly contains 1 MB ROM and 64 MB of RAM, although Apple makes no mention of this on its technical specifications page. That's because the numbers mean little to users. The iPod's internal memory is only used to boot up its OS and to cache music playback so that songs don't skip and so the hard drive doesn't need to run all the time. Having more RAM in the iPod would not be necessarily be "better."
 
In comparison, the latest smartphones typically only have 128 MB of Flash RAM and 64 MB of RAM as well, although they are expected to run more applications.
 
It is likely that the iPhone has at least 256 MB RAM in addition to its 4 or 8 GB of Flash. It appears that its copy of OS X and installed apps are stored in Flash RAM, and consume about 500 MB. That would leave around 3.5 GB for music, email, and other storage on the base model.
 
That’s still 28 times the Flash RAM capacity that any common Pocket PC or Treo has. Clearly, Apple expects users to actually use the iPhone, not just carry it around as a status symbol or to keep IT staff busy.
 
Reviewers like to throw around total RAM numbers in direct comparisons, but this is often misleading, particularly when comparing different architectures and different types of memory. It is particularly annoying when people suggest that SD memory cards can be used to make up for limited internal system RAM. This is not the case.
 
Inserting Flash RAM cards (Compact Flash, SD, MemoryStick, or similar) only adds to the amount of storage Flash RAM available, not system RAM. More Flash RAM is like have a bigger hard drive on a desktop PC: it makes no difference in the amount of memory available to running applications. It only adds to the amount of storage available for pictures and data files.
 
Here's how Palm OS and WinCE / Windows Mobile devices compare in their RAM use.
 
Palm RAM use
Palm devices were originally designed to run using a very minimal amount of RAM. The original Newton-era Palm Pilots from a decade ago had .5 or 1 MB of RAM; the Newton MessagePad 2000 had 8 MB RAM and 8 MB of ROM.
 
On the Palm, everything ran directly from memory. The device never really turned off, it just went to sleep.
 
By 2003, the Palm Treo 600 had grown to use 32 MB of RAM. Only 24 MB of that was actually available to the user however; the rest is eaten up by the Palm OS itself. Installing an application such as the Documents to Go Office file reader ate up another 5 MB, leaving only 19 MB available.
 
This relatively tiny bit of RAM isn't a huge problem for the Palm OS, because it can only run one application at a time anyway.
 
In the Treo 650, Palm changed how RAM worked. It uses 32 MB of Flash RAM, and 32 MB of system RAM. The Flash RAM storage is analogous to a hard drive; it contains a 9 MB ROM image of the Palm OS, leaving around 23 MB for user storage.
 
That was actually less available storage compared to the previous Treo 600 model it replaced. Other differences resulted in the same files taking up more space than they did before.
 
The 32 MB of system RAM actually runs the OS and apps, like RAM in a PC. When starting up, the Palm OS uncompresses from an image in Flash RAM to consume around 15 MB of the system RAM, leaving a paltry 18 MB for all running applications, caches, and peripheral use including camera photos as they are captured.
 
The latest Palm 700p has 128 MB of Flash RAM storage built in, 60 MB of which is available to the user, and 64 MB of system RAM.
 
No amount of SD cards could make the Palm Treo a fast, multitasking machine however; its memory capacity and potential is artificially stuck in legacy. That helps to explain why Palm recently sold out to Windows Mobile.
  
Windows Mobile RAM Use
WM / WinCE similarly used to store everything in system memory, like a big RAM disk. Powering off the unit off would destroy anything in memory, just as it would on a PC.
 
In Windows Mobile 5, Microsoft introduced the Palm-like convention of persistent storage. Files are all stored in Flash RAM, and only copied into system RAM while running. When the device runs out of power, everything copied to Flash RAM is retained.
 
Existing devices designed to run the previous Windows Mobile 2003 typically had no or very little Flash RAM. This prevents them from upgrading to Windows Mobile 5, which requires a certain amount of Flash RAM to run.
 
Palm's Windows Mobile version of the Treo 700 has the same 128 MB of Flash RAM for storage, and 64 MB of RAM as the Palm OS version. Windows Mobile 5 similarly leaves about 60 MB of the Flash RAM disk-type storage available to the user.
 
The HTC TyTN, Motorola Q, Samsung Blackjack, and other common Windows Mobile 5 Smartphone and Pocket PC devices all have around 64 MB or RAM, and 128 MB or more Flash RAM, a paltry amount compared to the iPhone’s 4096 MB or 8192 MB of Flash RAM. Again, the iPhone is equipped to be useful.
 
WinCE = OSXCE?
Given the significant extra resources available to the iPhone, how does will its OS X compare to Microsoft’s WinCE / Windows Mobile? The next article will take a look.
 
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

Thursday, January 25, 2007
| | Del.icio.us | Technorati | About RDM : :