views:

470

answers:

3

Is it a separate branch of Mac OS X? If so, does the code get synchronized with 10.6?

(that might be somewhat a separate question, but why couldn't they make a Mobile Leopard rather then separate OS for iPhone?)

Please do try to respect the Apple's NDAs while answering.

Update: I start to get the rough idea:

  • the open source kernel, Darwin, roughly the same
    • note that Darwin includes mDNSResponder and launchd
  • UI implements similar ideas in different contexts with different APIs
  • Webkit, I guess, is the same
  • what about Core Audio/Video/Quicktime, Spotlight and other services?
+2  A: 

The iPhone has different uses than a typical Mac, so the OS is optimized for those.

For example, the iPhone has to work as fast as possible given its (relative) slow peocessor (aprox 400Mhz). The user doesn't want to wait too much for an application to load or close. So the iPhone OS doesn't have virtual memory, it only uses the available RAM.

The same goes for the UI: the iPhone has a very small multitouch UI, a Mac has a much bigger screen and is used with a mouse/trackpad.

Marco Mustapic
So, is it written from scratch?
ilya n.
I really don't know, the above is knowledge from the iPhone documentation. But I suppose they started from a common sourcecode base and kept working from it.
Marco Mustapic
+6  A: 

The Darwin core (underlying UNIX-like system) is more or less the same code base (with some differences) adapted for ARM architecture. Higher OS layers (e.g. Cocoa Touch), while probably do share some code with their desktop counterpart, are specifically written for the iPhone platform which is significantly different from desktop in terms of screen size, processing power, storage and most importantly, user interface.

Update:

I disagree that UI is a completely different library though. While it's a separate set of APIs (UIKit in iPhone OS and AppKit in Mac OS X), the fundamental ideas are pretty much the same and are coming from their NeXTSTEP heritage. Core Audio is very similar on the surface to its desktop version but I guess the implementation might have some hardware optimizations to better suit iPhone hardware and usage scenarios. Networking is handled at the low level by Darwin which is the same across both OSes and at higher level by Cocoa APIs which is also pretty much identical.

Personally, I think iPhone OS is "Mobile Leopard" as much as it made sense. While Windows Embedded CE is more similar to desktop Windows at the API level, the underlying core is very different. In that sense, Mac OS X and iPhone OS are much more similar. However, it didn't make sense to use an identical set of UI APIs for both as their characteristics are very different at that level. They didn't want to sacrifice iPhone UI at any cost. It wasn't supposed to bring a desktop experience to the phone but to create a great experience really suited for such a device. I believe iPhone has succeeded in reaching that goal so Apple has made the correct decision in going with this route ;)

Mehrdad Afshari
Thank you, this is an extremely informative answer. Yes, I agree that having a completely separate API is necessary since the UI is different. As for fundamental ideas, I'm very impressed with how many of Mac concepts throughout the years seem to be more natural on the minicomputer rather than on a desktop. The concepts scale amazingly well.
ilya n.
@ilya n.: I'd rather give more credit to hardware getting more powerful. The iPhone is certainly much more powerful than the original NeXT computers in which these fundamental ideas are conceived.
Mehrdad Afshari
@Mehrdad: True, but I think Apple got some very user-friendly ideas that scale well right from the start, for example Address Book, Spotlight, and controlling the whole user experience (selling hardware+software+warranty+user service). In fact, the last one isn't supposed to work in the desktop market, and indeed Apple is much better in laptop/minicomputer stuff.
ilya n.
+1  A: 

The Mac OS and iPhone OS are pretty close, depending on your view. They both use Objective C for native applications, and they both use the same "Safari" web engine. They both have the same Unix underpinnings. Just look at what you can to after jail breaking a phone. You use most of the same libraries to develop applications, although the iPhone has some specific to the platform.

OS 10.6 and iPhone OS 3.0 I think are a lot closer than 10.5 and 2.2. Since the hardware is a lot less capable, there are obviously some differences. For example, there is no garbage collection/memory management on the iPhone, you have to do it yourself. The old fashioned way. I imagine the iPhone OS is also compiled with different flags (i.e. optimized for memory). You can run the iPhone OS in Xcode to test things, you can even run code on your iPhone and monitor it in Xcode.

Why is there no a Mobile Leopard? I think Apple learned from Windows CE. The interface just doesn't scale down well. Deep down though they are very much related (in my opinion). The interfaces are very different.

Brent Baisley